19#ifndef HIERBEM_INCLUDE_HMATRIX_HMATRIX_H_
20#define HIERBEM_INCLUDE_HMATRIX_HMATRIX_H_
22#include <deal.II/base/logstream.h>
23#include <deal.II/base/numbers.h>
24#include <deal.II/base/thread_management.h>
25#include <deal.II/base/types.h>
27#include <deal.II/lac/full_matrix.h>
28#include <deal.II/lac/vector.h>
30#include <openblas-pthread/cblas.h>
50#include "linear_algebra/lapack_full_matrix_ext.h"
52#include "sequence_partition/sequence_partition.h"
58using namespace dealii;
78 <<
"Invalid H-matrix node type: " << arg1);
85 <<
"Invalid H-matrix node state: " << arg1);
92 <<
"Invalid H-matrix node property: " << arg1);
100 <<
"Invalid H-matrix node block type: " << arg1);
102template <
int spacedim,
typename Number =
double>
109 using size_type = std::make_unsigned<types::blas_int>::type;
110 using value_type = Number;
111 using real_type =
typename numbers::NumberTraits<Number>::real_type;
156 memory_consumption()
const
254 std::vector<std::array<types::global_dof_index, 2>>
263 std::vector<std::array<types::global_dof_index, 2>>
270 using TaskNode = tbb::flow::continue_node<tbb::flow::continue_msg>;
271 using TaskNodePtr = std::shared_ptr<TaskNode>;
287 : diagonal_hmat_node(diag)
299 return sizeof(*this);
306 template <
int spacedim1,
typename Number1>
308 InitHMatrixWrtBlockClusterNode(
311 typename numbers::NumberTraits<Number1>::
312 real_type>::node_const_pointer_type
bc_node);
314 template <
int spacedim1,
typename Number1>
316 InitHMatrixWrtBlockClusterNode(
319 typename numbers::NumberTraits<Number1>::
320 real_type>::node_const_pointer_type
bc_node,
324 template <
int spacedim1,
typename Number1>
326 InitHMatrixWrtBlockClusterNode(
329 typename numbers::NumberTraits<Number1>::
330 real_type>::node_const_pointer_type
bc_node,
334 template <
int spacedim1,
typename Number1>
336 InitAndCreateHMatrixChildrenWithoutAlloc(
339 typename numbers::NumberTraits<Number1>::
340 real_type>::node_const_pointer_type
bc_node);
342 template <
int spacedim1,
typename Number1>
344 InitAndCreateHMatrixChildren(
347 typename numbers::NumberTraits<Number1>::
348 real_type>::node_const_pointer_type
bc_node,
349 const unsigned int fixed_rank_k,
352 template <
int spacedim1,
typename Number1>
354 InitAndCreateHMatrixChildren(
357 typename numbers::NumberTraits<Number1>::
358 real_type>::node_const_pointer_type
bc_node,
359 const unsigned int fixed_rank_k,
363 template <
int spacedim1,
typename Number1>
365 InitAndCreateHMatrixChildren(
368 typename numbers::NumberTraits<Number1>::
369 real_type>::node_const_pointer_type
bc_node,
373 template <
int spacedim1,
typename Number1>
375 InitAndCreateHMatrixChildren(
378 typename numbers::NumberTraits<Number1>::
379 real_type>::node_const_pointer_type
bc_node,
380 const unsigned int fixed_rank_k,
382 const std::array<types::global_dof_index, 2> &M_row_index_range,
383 const std::array<types::global_dof_index, 2> &M_col_index_range,
386 template <
int spacedim1,
typename Number1>
388 InitAndCreateHMatrixChildren(
391 typename numbers::NumberTraits<Number1>::
392 real_type>::node_const_pointer_type
bc_node,
394 const std::array<types::global_dof_index, 2> &M_row_index_range,
395 const std::array<types::global_dof_index, 2> &M_col_index_range,
398 template <
int spacedim1,
typename Number1>
400 InitAndCreateHMatrixChildren(
403 typename numbers::NumberTraits<Number1>::
404 real_type>::node_const_pointer_type
bc_node,
407 template <
int spacedim1,
typename Number1>
409 RefineHMatrixWrtExtendedBlockClusterTree(
413 template <
int spacedim1,
typename Number1>
416 const unsigned int fixed_rank_k,
418 size_t *calling_counter,
419 const std::string &output_file_base_name);
422 template <
int spacedim1,
typename Number1>
428 template <
int spacedim1,
typename Number1>
430 h_rk_mmult(
const Number1 alpha,
435 template <
int spacedim1,
typename Number1>
441 template <
int spacedim1,
typename Number1>
443 h_rk_mTmult(
const Number1 alpha,
448 template <
int spacedim1,
typename Number1>
454 template <
int spacedim1,
typename Number1>
456 h_rk_Tmmult(
const Number1 alpha,
461 template <
int spacedim1,
typename Number1>
466 bool is_M1M2_last_in_M_Sigma_P);
468 template <
int spacedim1,
typename Number1>
474 template <
int spacedim1,
typename Number1>
476 rk_h_mmult(
const Number1 alpha,
481 template <
int spacedim1,
typename Number1>
487 template <
int spacedim1,
typename Number1>
489 rk_h_mTmult(
const Number1 alpha,
494 template <
int spacedim1,
typename Number1>
500 template <
int spacedim1,
typename Number1>
502 rk_h_Tmmult(
const Number1 alpha,
507 template <
int spacedim1,
typename Number1>
512 bool is_M1M2_last_in_M_Sigma_P);
514 template <
int spacedim1,
typename Number1>
520 template <
int spacedim1,
typename Number1>
522 h_f_mmult(
const Number1 alpha,
527 template <
int spacedim1,
typename Number1>
533 template <
int spacedim1,
typename Number1>
535 h_f_mTmult(
const Number1 alpha,
540 template <
int spacedim1,
typename Number1>
546 template <
int spacedim1,
typename Number1>
548 h_f_Tmmult(
const Number1 alpha,
553 template <
int spacedim1,
typename Number1>
559 template <
int spacedim1,
typename Number1>
561 h_f_mmult(
const Number1 alpha,
566 template <
int spacedim1,
typename Number1>
572 template <
int spacedim1,
typename Number1>
574 h_f_mTmult(
const Number1 alpha,
579 template <
int spacedim1,
typename Number1>
585 template <
int spacedim1,
typename Number1>
587 h_f_Tmmult(
const Number1 alpha,
592 template <
int spacedim1,
typename Number1>
597 bool is_M1M2_last_in_M_Sigma_P);
599 template <
int spacedim1,
typename Number1>
605 template <
int spacedim1,
typename Number1>
607 f_h_mmult(
const Number1 alpha,
612 template <
int spacedim1,
typename Number1>
618 template <
int spacedim1,
typename Number1>
620 f_h_mTmult(
const Number1 alpha,
625 template <
int spacedim1,
typename Number1>
631 template <
int spacedim1,
typename Number1>
633 f_h_Tmmult(
const Number1 alpha,
638 template <
int spacedim1,
typename Number1>
644 template <
int spacedim1,
typename Number1>
646 f_h_mmult(
const Number1 alpha,
651 template <
int spacedim1,
typename Number1>
657 template <
int spacedim1,
typename Number1>
659 f_h_mTmult(
const Number1 alpha,
664 template <
int spacedim1,
typename Number1>
670 template <
int spacedim1,
typename Number1>
672 f_h_Tmmult(
const Number1 alpha,
677 template <
int spacedim1,
typename Number1>
682 bool is_M1M2_last_in_M_Sigma_P);
684 template <
int spacedim1,
typename Number1>
686 h_h_mmult_phase1_recursion(
689 typename numbers::NumberTraits<Number1>::real_type> &
Tind);
691 template <
int spacedim1,
typename Number1>
696 typename numbers::NumberTraits<Number1>::real_type>
698 const unsigned int fixed_rank);
700 template <
int spacedim1,
typename Number1>
702 h_h_mmult_from_leaf_node(
708 const unsigned int fixed_rank,
709 const bool is_result_matrix_symm_apriori);
711 template <
int spacedim1,
typename Number1>
713 h_h_mmult_from_leaf_node(
720 const unsigned int fixed_rank,
721 const bool is_result_matrix_store_tril_only);
723 template <
int spacedim1,
typename Number1>
725 h_h_mmult_from_leaf_node_for_parallel_lu(
732 const unsigned int fixed_rank,
733 const bool is_result_matrix_store_tril_only);
735 template <
int spacedim1,
typename Number1>
737 h_h_mTmult_from_leaf_node(
743 const unsigned int fixed_rank,
744 const bool is_result_matrix_store_tril_only);
746 template <
int spacedim1,
typename Number1>
748 h_h_mTmult_from_leaf_node(
755 const unsigned int fixed_rank,
756 const bool is_result_matrix_store_tril_only);
758 template <
int spacedim1,
typename Number1>
760 h_h_mTmult_from_leaf_node_for_parallel_cholesky(
767 const unsigned int fixed_rank,
768 const bool is_result_matrix_store_tril_only);
770 template <
int spacedim1,
typename Number1>
772 h_h_Tmmult_from_leaf_node(
778 const unsigned int fixed_rank,
779 const bool is_result_matrix_store_tril_only);
781 template <
int spacedim1,
typename Number1>
783 h_h_Tmmult_from_leaf_node(
790 const unsigned int fixed_rank,
791 const bool is_result_matrix_store_tril_only);
793 template <
int spacedim1,
typename Number1>
798 const unsigned int fixed_rank,
799 const bool is_result_matrix_store_tril_only);
801 template <
int spacedim1,
typename Number1>
807 const unsigned int fixed_rank,
808 const bool is_result_matrix_store_tril_only);
810 template <
int spacedim1,
typename Number1>
812 h_h_mmult_level_conserving_for_parallel_lu(
817 const unsigned int fixed_rank,
818 const bool is_result_matrix_store_tril_only);
820 template <
int spacedim1,
typename Number1>
825 const unsigned int fixed_rank,
826 const bool is_result_matrix_store_tril_only);
828 template <
int spacedim1,
typename Number1>
834 const unsigned int fixed_rank,
835 const bool is_result_matrix_store_tril_only);
837 template <
int spacedim1,
typename Number1>
839 h_h_mTmult_level_conserving_for_parallel_cholesky(
844 const unsigned int fixed_rank,
845 const bool is_result_matrix_store_tril_only);
847 template <
int spacedim1,
typename Number1>
852 const unsigned int fixed_rank,
853 const bool is_result_matrix_store_tril_only);
855 template <
int spacedim1,
typename Number1>
861 const unsigned int fixed_rank,
862 const bool is_result_matrix_store_tril_only);
864 template <
int spacedim1,
typename Number1>
869 template <
int spacedim1,
typename Number1>
874 template <
int spacedim1,
typename Number1>
879 template <
int spacedim1,
typename Number1>
881 print_h_submatrix_accessor(std::ostream &out,
882 const std::string &name,
885 template <
int spacedim1,
typename Number1>
887 print_h_h_submatrix_mmult_accessor(std::ostream &out,
888 const std::string &name1,
890 const std::string &name2,
893 template <
int spacedim1,
typename Number1>
898 const Vector<Number1> &b);
900 template <
int spacedim1,
typename Number1>
904 const Vector<Number1> &b);
931 const unsigned int fixed_rank_k = 1,
934 HMatrixSupport::BlockType::undefined_block);
948 const unsigned int fixed_rank_k = 1,
951 HMatrixSupport::BlockType::undefined_block);
965 const unsigned int fixed_rank_k,
967 HMatrixSupport::BlockType::diagonal_block);
984 HMatrixSupport::BlockType::diagonal_block);
1003 const unsigned int fixed_rank_k,
1006 HMatrixSupport::BlockType::undefined_block);
1029 HMatrixSupport::BlockType::undefined_block);
1044 HMatrixSupport::BlockType::undefined_block);
1062 HMatrixSupport::BlockType::diagonal_block);
1091 const unsigned int fixed_rank_k = 1,
1094 HMatrixSupport::BlockType::diagonal_block);
1106 const unsigned int fixed_rank_k = 1,
1109 HMatrixSupport::BlockType::undefined_block);
1146 template <
typename MatrixType>
1392 std::vector<HMatrix<spacedim, Number> *> &
1400 const std::vector<HMatrix<spacedim, Number> *> &
1416 const unsigned int precision = 3,
1417 const bool scientific =
true,
1418 const unsigned int width = 0,
1419 const char *zero_string =
" ",
1420 const double denominator = 1.,
1421 const double threshold = 0.)
const;
1462 const std::string &name,
1463 const unsigned int precision = 8,
1464 const bool scientific =
true,
1465 const unsigned int width = 0,
1466 const char *zero_string =
"0",
1467 const double denominator = 1.,
1468 const double threshold = 0.)
const;
1496 const real_type singular_value_threshold = 0.)
const;
1532 const real_type singular_value_threshold = 0.)
const;
1552 const real_type singular_value_threshold = 0.)
const;
1624 const bool is_only_handle_tril =
true);
1638 const bool is_only_handle_tril =
true);
1652 const bool is_compensate_diag_blocks =
true);
1699 const Vector<Number> &x,
1731 template <
typename Number2>
1734 const Number2 alpha,
1735 const Vector<Number> &x,
1753 const Vector<Number> &x,
1771 template <
typename Number2>
1774 const Number2 alpha,
1775 const Vector<Number> &x,
1791 template <
typename Number2,
typename Number3>
1795 const Number3 alpha,
1796 const Vector<Number> &x)
const;
1813 template <
typename Number2,
typename Number3>
1817 const Number3 alpha,
1818 const Vector<Number> &x)
const;
1825 vmult(Vector<Number> &y,
const Vector<Number> &x)
const;
1832 vmult_add(Vector<Number> &y,
const Vector<Number> &x)
const;
1838 template <
typename Number2>
1840 vmult(Vector<Number> &y,
const Number2 alpha,
const Vector<Number> &x)
const;
1846 template <
typename Number2>
1849 const Number2 alpha,
1850 const Vector<Number> &x)
const;
1874 const Vector<Number> &x,
1898 template <
typename Number2>
1901 const Number2 alpha,
1902 const Vector<Number> &x,
1919 const Vector<Number> &x,
1936 template <
typename Number2>
1939 const Number2 alpha,
1940 const Vector<Number> &x,
1956 template <
typename Number2,
typename Number3>
1960 const Number3 alpha,
1961 const Vector<Number> &x)
const;
1981 template <
typename Number2,
typename Number3>
1985 const Number3 alpha,
1986 const Vector<Number> &x)
const;
1993 Tvmult(Vector<Number> &y,
const Vector<Number> &x)
const;
2007 template <
typename Number2>
2009 Tvmult(Vector<Number> &y,
const Number2 alpha,
const Vector<Number> &x)
const;
2016 template <
typename Number2>
2019 const Number2 alpha,
2020 const Vector<Number> &x)
const;
2037 const Vector<Number> &x,
2054 template <
typename Number2>
2057 const Number2 alpha,
2058 const Vector<Number> &x,
2070 template <
typename Number2,
typename Number3>
2074 const Number3 alpha,
2075 const Vector<Number> &x)
const;
2091 template <
typename Number2,
typename Number3>
2095 const Number3 alpha,
2096 const Vector<Number> &x)
const;
2112 const Vector<Number> &x,
2129 template <
typename Number2>
2132 const Number2 alpha,
2133 const Vector<Number> &x,
2142 Hvmult(Vector<Number> &y,
const Vector<Number> &x)
const;
2156 template <
typename Number2>
2158 Hvmult(Vector<Number> &y,
const Number2 alpha,
const Vector<Number> &x)
const;
2165 template <
typename Number2>
2168 const Number2 alpha,
2169 const Vector<Number> &x)
const;
2214 const unsigned int fixed_rank = 1);
2234 const unsigned int fixed_rank,
2249 const unsigned int fixed_rank,
2250 const bool is_result_matrix_store_tril_only =
false);
2267 const unsigned int fixed_rank,
2268 const bool is_result_matrix_store_tril_only =
false);
2271 mmult_level_conserving_for_parallel_lu(
2275 const unsigned int fixed_rank,
2276 const bool is_result_matrix_store_tril_only =
false);
2291 const unsigned int fixed_rank,
2292 const bool is_result_matrix_store_tril_only =
false);
2309 const unsigned int fixed_rank,
2310 const bool is_result_matrix_store_tril_only =
false);
2313 mTmult_level_conserving_for_parallel_cholesky(
2317 const unsigned int fixed_rank,
2318 const bool is_result_matrix_store_tril_only =
false);
2333 const unsigned int fixed_rank,
2334 const bool is_result_matrix_store_tril_only =
false);
2351 const unsigned int fixed_rank,
2352 const bool is_result_matrix_store_tril_only =
false);
2434 const std::array<types::global_dof_index, 2> &B_row_index_range,
2435 const std::array<types::global_dof_index, 2> &B_col_index_range,
2437 const bool is_result_matrix_store_tril_only =
false)
const;
2442 const std::array<types::global_dof_index, 2> &B_row_index_range,
2443 const std::array<types::global_dof_index, 2> &B_col_index_range,
2445 const bool is_result_matrix_store_tril_only =
false);
2462 const std::array<types::global_dof_index, 2> &B_row_index_range,
2463 const std::array<types::global_dof_index, 2> &B_col_index_range,
2465 const bool is_result_matrix_store_tril_only =
false)
const;
2489 const bool is_result_matrix_store_tril_only =
false);
2495 const bool is_result_matrix_store_tril_only =
false);
2514 const bool is_result_matrix_store_tril_only =
false);
2578 const bool is_unit_diagonal =
true)
const;
2592 const Vector<Number> &b,
2593 const bool is_unit_diagonal =
true)
const;
2613 const bool is_unit_diagonal =
true)
const;
2628 const Vector<Number> &b,
2630 const bool is_unit_diagonal =
true)
const;
2656 const unsigned int fixed_rank,
2657 const bool is_unit_diagonal =
true)
const;
2674 const unsigned int fixed_rank,
2675 const bool is_unit_diagonal =
true)
const;
2698 const unsigned int fixed_rank)
const;
2703 const unsigned int fixed_rank)
const;
2733 const Vector<Number> &b)
const;
2767 const Vector<Number> &b,
2789 const unsigned int fixed_rank)
const;
2805 const unsigned int fixed_rank)
const;
2830 const unsigned int fixed_rank)
const;
2835 const unsigned int fixed_rank)
const;
2868 const bool is_unit_block_diagonal =
true)
const;
2884 const Vector<Number> &b,
2885 const bool is_unit_block_diagonal =
true)
const;
2921 const bool is_unit_block_diagonal =
true)
const;
2956 const Vector<Number> &b,
2958 const bool is_unit_block_diagonal =
true)
const;
2997 const Vector<Number> &b)
const;
3029 const Vector<Number> &b,
3052 const bool is_unit_diagonal =
false)
const;
3072 const Vector<Number> &b,
3073 const bool is_unit_diagonal =
false)
const;
3097 const bool is_unit_diagonal =
false)
const;
3118 const Vector<Number> &b,
3120 const bool is_unit_diagonal =
false)
const;
3153 const bool is_unit_block_diagonal =
false)
const;
3187 const Vector<Number> &b,
3188 const bool is_unit_block_diagonal =
false)
const;
3223 const bool is_unit_block_diagonal =
false)
const;
3258 const Vector<Number> &b,
3260 const bool is_unit_block_diagonal =
false)
const;
3288 const Vector<Number> &b)
const;
3320 const Vector<Number> &b,
3337 const unsigned int fixed_rank);
3376 const unsigned int fixed_rank);
3415 solve_lu(Vector<Number> &x,
const Vector<Number> &b)
const;
3450 const unsigned int fixed_rank_k);
3474 const unsigned int fixed_rank_k);
3522 std::vector<HMatrix<spacedim, Number> *> &
3530 const std::vector<HMatrix<spacedim, Number> *> &
3533 std::vector<HMatrix<spacedim, Number> *> &
3534 get_near_field_leaf_set();
3536 const std::vector<HMatrix<spacedim, Number> *> &
3537 get_near_field_leaf_set()
const;
3539 std::vector<HMatrix<spacedim, Number> *> &
3540 get_far_field_leaf_set();
3542 const std::vector<HMatrix<spacedim, Number> *> &
3543 get_far_field_leaf_set()
const;
3552 std::array<types::global_dof_index, 2> *
3562 const std::array<types::global_dof_index, 2> *
3572 std::array<types::global_dof_index, 2> *
3582 const std::array<types::global_dof_index, 2> *
3593 typename std::vector<HMatrix<spacedim, Number> *>::iterator
3605 typename std::vector<HMatrix<spacedim, Number> *>::const_iterator
3663 const unsigned int fixed_rank_k2 = 1);
3743 std::vector<double> &task_costs)
const;
3755 std::vector<double> &task_costs)
const;
3767 std::vector<double> &task_costs)
const;
3777 const bool is_tvmult)
const;
3838 template <
typename MatrixType>
3842 HMatrixSupport::Property::general)
const;
3862 HMatrixSupport::Property::general)
const;
3871 std::vector<HMatrix *> &total_leaf_set,
3872 std::vector<HMatrix *> &total_near_field_leaf_set,
3873 std::vector<HMatrix *> &total_far_field_leaf_set,
3878 std::vector<HMatrix *> &total_leaf_set,
3879 std::vector<HMatrix *> &total_near_field_leaf_set,
3880 std::vector<HMatrix *> &total_far_field_leaf_set,
3886 const unsigned int fixed_rank = 0);
3889 distribute_sigma_r_and_f_to_leaves(
const unsigned int fixed_rank = 0);
3893 const unsigned int fixed_rank = 0);
3921 const unsigned int fixed_rank)
const;
3943 const unsigned int fixed_rank,
3944 std::mutex &log_stream_lock);
3953 std::mutex &log_stream_lock);
3965 const unsigned int fixed_rank,
3966 std::mutex &log_stream_lock);
3978 const unsigned int fixed_rank,
3979 std::mutex &log_stream_lock);
3996 const unsigned int fixed_rank,
3997 std::mutex &log_stream_lock);
4060 const unsigned int fixed_rank)
const;
4080 const unsigned int fixed_rank,
4081 std::mutex &log_stream_lock);
4090 std::mutex &log_stream_lock);
4102 const unsigned int fixed_rank,
4103 std::mutex &log_stream_lock);
4120 const unsigned int fixed_rank,
4121 std::mutex &log_stream_lock);
4212 const std::pair<int64_t, int64_t> &interval,
4213 const unsigned int thread_no);
4223 const std::pair<int64_t, int64_t> &interval,
4224 const unsigned int thread_no);
4232 const unsigned int thread_no);
4240 const unsigned int thread_no);
4403 std::vector<LAPACKFullMatrixExt<Number> *>
Sigma_F;
4435 std::unique_ptr<std::vector<VmultOrTvmultThreadData>>
4440template <
int spacedim,
typename Number>
4453template <
int spacedim,
typename Number =
double>
4458 typename numbers::NumberTraits<Number>::real_type>::
4459 node_const_pointer_type bc_node)
4466 typename numbers::NumberTraits<Number>::real_type
>::node_pointer_type>(
4473 hmat.
row_index_range =
const_cast<std::array<types::global_dof_index, 2> *
>(
4474 &(hmat.
bc_node->get_data_reference()
4476 ->get_data_reference()
4477 .get_index_range()));
4478 hmat.
col_index_range =
const_cast<std::array<types::global_dof_index, 2> *
>(
4479 &(hmat.
bc_node->get_data_reference()
4481 ->get_data_reference()
4482 .get_index_range()));
4505template <
int spacedim,
typename Number =
double>
4510 typename numbers::NumberTraits<Number>::real_type>::
4511 node_const_pointer_type bc_node,
4520 typename numbers::NumberTraits<Number>::real_type
>::node_pointer_type>(
4527 hmat.
row_index_range =
const_cast<std::array<types::global_dof_index, 2> *
>(
4528 &(hmat.
bc_node->get_data_reference()
4530 ->get_data_reference()
4531 .get_index_range()));
4532 hmat.
col_index_range =
const_cast<std::array<types::global_dof_index, 2> *
>(
4533 &(hmat.
bc_node->get_data_reference()
4535 ->get_data_reference()
4536 .get_index_range()));
4545 &hmat_pair : Sigma_P)
4547 hmat.
Sigma_P.push_back(hmat_pair);
4564template <
int spacedim,
typename Number =
double>
4569 typename numbers::NumberTraits<Number>::real_type>::
4570 node_const_pointer_type bc_node,
4579 typename numbers::NumberTraits<Number>::real_type
>::node_pointer_type>(
4586 hmat.
row_index_range =
const_cast<std::array<types::global_dof_index, 2> *
>(
4587 &(hmat.
bc_node->get_data_reference()
4589 ->get_data_reference()
4590 .get_index_range()));
4591 hmat.
col_index_range =
const_cast<std::array<types::global_dof_index, 2> *
>(
4592 &(hmat.
bc_node->get_data_reference()
4594 ->get_data_reference()
4595 .get_index_range()));
4603 hmat.
Sigma_P.push_back(hmat_pair);
4619template <
int spacedim,
typename Number =
double>
4624 typename numbers::NumberTraits<Number>::real_type>::
4625 node_const_pointer_type bc_node)
4632 typename numbers::NumberTraits<Number>::real_type
>::node_pointer_type>(
4639 hmat->
row_index_range =
const_cast<std::array<types::global_dof_index, 2> *
>(
4640 &(hmat->
bc_node->get_data_reference()
4642 ->get_data_reference()
4643 .get_index_range()));
4644 hmat->
col_index_range =
const_cast<std::array<types::global_dof_index, 2> *
>(
4645 &(hmat->
bc_node->get_data_reference()
4647 ->get_data_reference()
4648 .get_index_range()));
4656 const unsigned int bc_node_child_num = bc_node->get_child_num();
4657 if (bc_node_child_num > 0)
4668 for (
unsigned int i = 0; i < bc_node_child_num; i++)
4688 case HMatrixSupport::BlockType::undefined_block: {
4697 case HMatrixSupport::BlockType::diagonal_block: {
4708 HMatrixSupport::BlockType::diagonal_block;
4714 HMatrixSupport::BlockType::upper_triangular_block;
4720 HMatrixSupport::BlockType::lower_triangular_block;
4726 HMatrixSupport::BlockType::diagonal_block;
4731 Assert(
false, ExcNotImplemented());
4738 case HMatrixSupport::BlockType::upper_triangular_block: {
4747 case HMatrixSupport::BlockType::lower_triangular_block: {
4759 std::string(
"Invalid H-matrix block type: ") +
4771 case HMatrixSupport::Property::general: {
4776 child_hmat->
property = HMatrixSupport::Property::general;
4780 case HMatrixSupport::Property::symmetric: {
4787 HMatrixSupport::BlockType::diagonal_block)
4790 HMatrixSupport::Property::symmetric;
4794 child_hmat->
property = HMatrixSupport::Property::general;
4799 case HMatrixSupport::Property::hermite_symmetric: {
4806 HMatrixSupport::BlockType::diagonal_block)
4809 HMatrixSupport::Property::hermite_symmetric;
4813 child_hmat->
property = HMatrixSupport::Property::general;
4818 case HMatrixSupport::Property::upper_triangular: {
4826 HMatrixSupport::BlockType::diagonal_block)
4829 HMatrixSupport::Property::upper_triangular;
4833 child_hmat->
property = HMatrixSupport::Property::general;
4838 case HMatrixSupport::Property::lower_triangular: {
4846 HMatrixSupport::BlockType::diagonal_block)
4849 HMatrixSupport::Property::lower_triangular;
4853 child_hmat->
property = HMatrixSupport::Property::general;
4860 ExcMessage(
"Invalid H-matrix property: " +
4867 child_hmat, bc_node->get_child_pointer(i));
4878 child_hmat->
parent = hmat;
4894 if (bc_node->get_data_reference().get_is_near_field())
4907 if (hmat->
block_type == HMatrixSupport::BlockType::diagonal_block)
4911 case HMatrixSupport::Property::general: {
4913 LAPACKSupport::Property::general);
4917 case HMatrixSupport::Property::symmetric: {
4919 LAPACKSupport::Property::symmetric);
4923 case HMatrixSupport::Property::hermite_symmetric: {
4925 LAPACKSupport::Property::hermite_symmetric);
4929 case HMatrixSupport::Property::upper_triangular: {
4931 LAPACKSupport::Property::upper_triangular);
4935 case HMatrixSupport::Property::lower_triangular: {
4937 LAPACKSupport::Property::lower_triangular);
4943 ExcMessage(
"Invalid H-matrix property: " +
4974template <
int spacedim,
typename Number =
double>
4979 typename numbers::NumberTraits<Number>::real_type>::
4980 node_const_pointer_type bc_node,
4981 const unsigned int fixed_rank_k,
4983 HMatrixSupport::Property::general)
4990 typename numbers::NumberTraits<Number>::real_type
>::node_pointer_type>(
4997 hmat->
row_index_range =
const_cast<std::array<types::global_dof_index, 2> *
>(
4998 &(hmat->
bc_node->get_data_reference()
5000 ->get_data_reference()
5001 .get_index_range()));
5002 hmat->
col_index_range =
const_cast<std::array<types::global_dof_index, 2> *
>(
5003 &(hmat->
bc_node->get_data_reference()
5005 ->get_data_reference()
5006 .get_index_range()));
5014 const unsigned int bc_node_child_num = bc_node->get_child_num();
5015 if (bc_node_child_num > 0)
5026 for (
unsigned int i = 0; i < bc_node_child_num; i++)
5046 case HMatrixSupport::BlockType::undefined_block: {
5055 case HMatrixSupport::BlockType::diagonal_block: {
5066 HMatrixSupport::BlockType::diagonal_block;
5072 HMatrixSupport::BlockType::upper_triangular_block;
5078 HMatrixSupport::BlockType::lower_triangular_block;
5084 HMatrixSupport::BlockType::diagonal_block;
5089 Assert(
false, ExcNotImplemented());
5096 case HMatrixSupport::BlockType::upper_triangular_block: {
5105 case HMatrixSupport::BlockType::lower_triangular_block: {
5116 ExcMessage(
"Invalid H-matrix block type: " +
5128 case HMatrixSupport::Property::general: {
5133 child_hmat->
property = HMatrixSupport::Property::general;
5137 case HMatrixSupport::Property::symmetric: {
5144 HMatrixSupport::BlockType::diagonal_block)
5147 HMatrixSupport::Property::symmetric;
5151 child_hmat->
property = HMatrixSupport::Property::general;
5156 case HMatrixSupport::Property::hermite_symmetric: {
5163 HMatrixSupport::BlockType::diagonal_block)
5166 HMatrixSupport::Property::hermite_symmetric;
5170 child_hmat->
property = HMatrixSupport::Property::general;
5175 case HMatrixSupport::Property::upper_triangular: {
5183 HMatrixSupport::BlockType::diagonal_block)
5186 HMatrixSupport::Property::upper_triangular;
5190 child_hmat->
property = HMatrixSupport::Property::general;
5195 case HMatrixSupport::Property::lower_triangular: {
5203 HMatrixSupport::BlockType::diagonal_block)
5206 HMatrixSupport::Property::lower_triangular;
5210 child_hmat->
property = HMatrixSupport::Property::general;
5217 ExcMessage(
"Invalid H-matrix property: " +
5224 bc_node->get_child_pointer(i),
5226 top_hmat_node_property);
5237 child_hmat->
parent = hmat;
5253 switch (top_hmat_node_property)
5255 case HMatrixSupport::Property::general: {
5261 if (bc_node->get_data_reference().get_is_near_field())
5276 case HMatrixSupport::Property::symmetric: {
5285 case HMatrixSupport::BlockType::diagonal_block: {
5300 bc_node->get_data_reference().get_is_near_field(),
5302 "H-matrix node in the leaf set should belong to the near field if it is a diagonal block!"));
5309 hmat->
property == top_hmat_node_property,
5311 "A diagonal block should have the same property as that of the top level H-matrix node!"));
5317 LAPACKSupport::Property::symmetric);
5321 case HMatrixSupport::BlockType::lower_triangular_block: {
5329 if (bc_node->get_data_reference().get_is_near_field())
5345 case HMatrixSupport::BlockType::upper_triangular_block: {
5353 if (bc_node->get_data_reference().get_is_near_field())
5370 std::string(
"Invalid H-matrix block type: ") +
5371 std::string(HMatrixSupport::block_type_name(
5379 case HMatrixSupport::Property::hermite_symmetric: {
5388 case HMatrixSupport::BlockType::diagonal_block: {
5403 bc_node->get_data_reference().get_is_near_field(),
5405 "H-matrix node in the leaf set should belong to the near field if it is a diagonal block!"));
5412 hmat->
property == top_hmat_node_property,
5414 "A diagonal block should have the same property as that of the top level H-matrix node!"));
5420 LAPACKSupport::Property::hermite_symmetric);
5424 case HMatrixSupport::BlockType::lower_triangular_block: {
5432 if (bc_node->get_data_reference().get_is_near_field())
5448 case HMatrixSupport::BlockType::upper_triangular_block: {
5456 if (bc_node->get_data_reference().get_is_near_field())
5473 std::string(
"Invalid H-matrix block type: ") +
5474 std::string(HMatrixSupport::block_type_name(
5482 case HMatrixSupport::Property::lower_triangular: {
5491 case HMatrixSupport::BlockType::diagonal_block: {
5506 bc_node->get_data_reference().get_is_near_field(),
5508 "H-matrix node in the leaf set should belong to the near field if it is a diagonal block!"));
5515 hmat->
property == top_hmat_node_property,
5517 "A diagonal block should have the same property as that of the top level H-matrix node!"));
5523 LAPACKSupport::Property::lower_triangular);
5527 case HMatrixSupport::BlockType::lower_triangular_block: {
5535 if (bc_node->get_data_reference().get_is_near_field())
5551 case HMatrixSupport::BlockType::upper_triangular_block: {
5558 if (bc_node->get_data_reference().get_is_near_field())
5575 std::string(
"Invalid H-matrix block type: ") +
5576 std::string(HMatrixSupport::block_type_name(
5584 case HMatrixSupport::Property::upper_triangular: {
5593 case HMatrixSupport::BlockType::diagonal_block: {
5608 bc_node->get_data_reference().get_is_near_field(),
5610 "H-matrix node in the leaf set should belong to the near field if it is a diagonal block!"));
5617 hmat->
property == top_hmat_node_property,
5619 "A diagonal block should have the same property as that of the top level H-matrix node!"));
5625 LAPACKSupport::Property::upper_triangular);
5629 case HMatrixSupport::BlockType::upper_triangular_block: {
5637 if (bc_node->get_data_reference().get_is_near_field())
5653 case HMatrixSupport::BlockType::lower_triangular_block: {
5660 if (bc_node->get_data_reference().get_is_near_field())
5677 std::string(
"Invalid H-matrix block type: ") +
5678 std::string(HMatrixSupport::block_type_name(
5690 "Invalid property of the top level H-matrix node: ") +
5691 std::string(HMatrixSupport::property_name(
5692 top_hmat_node_property))));
5724template <
int spacedim,
typename Number =
double>
5729 typename numbers::NumberTraits<Number>::real_type>::
5730 node_const_pointer_type bc_node,
5731 const unsigned int fixed_rank_k,
5734 HMatrixSupport::Property::general)
5741 typename numbers::NumberTraits<Number>::real_type
>::node_pointer_type>(
5747 hmat->
row_index_range =
const_cast<std::array<types::global_dof_index, 2> *
>(
5748 &(hmat->
bc_node->get_data_reference()
5750 ->get_data_reference()
5751 .get_index_range()));
5752 hmat->
col_index_range =
const_cast<std::array<types::global_dof_index, 2> *
>(
5753 &(hmat->
bc_node->get_data_reference()
5755 ->get_data_reference()
5756 .get_index_range()));
5764 const unsigned int bc_node_child_num = bc_node->get_child_num();
5766 if (bc_node_child_num > 0)
5775 for (
unsigned int i = 0; i < bc_node_child_num; i++)
5795 case HMatrixSupport::BlockType::undefined_block: {
5804 case HMatrixSupport::BlockType::diagonal_block: {
5815 HMatrixSupport::BlockType::diagonal_block;
5821 HMatrixSupport::BlockType::upper_triangular_block;
5827 HMatrixSupport::BlockType::lower_triangular_block;
5833 HMatrixSupport::BlockType::diagonal_block;
5838 Assert(
false, ExcNotImplemented());
5845 case HMatrixSupport::BlockType::upper_triangular_block: {
5854 case HMatrixSupport::BlockType::lower_triangular_block: {
5864 Assert(
false, ExcInvalidHMatrixBlockType(hmat->
block_type));
5875 case HMatrixSupport::Property::general: {
5880 child_hmat->
property = HMatrixSupport::Property::general;
5884 case HMatrixSupport::Property::symmetric: {
5891 HMatrixSupport::BlockType::diagonal_block)
5894 HMatrixSupport::Property::symmetric;
5898 child_hmat->
property = HMatrixSupport::Property::general;
5903 case HMatrixSupport::Property::hermite_symmetric: {
5910 HMatrixSupport::BlockType::diagonal_block)
5913 HMatrixSupport::Property::hermite_symmetric;
5917 child_hmat->
property = HMatrixSupport::Property::general;
5922 case HMatrixSupport::Property::upper_triangular: {
5930 HMatrixSupport::BlockType::diagonal_block)
5933 HMatrixSupport::Property::upper_triangular;
5937 child_hmat->
property = HMatrixSupport::Property::general;
5942 case HMatrixSupport::Property::lower_triangular: {
5950 HMatrixSupport::BlockType::diagonal_block)
5953 HMatrixSupport::Property::lower_triangular;
5957 child_hmat->
property = HMatrixSupport::Property::general;
5963 Assert(
false, ExcInvalidHMatrixProperty(hmat->
property));
5969 bc_node->get_child_pointer(i),
5972 top_hmat_node_property);
5983 child_hmat->
parent = hmat;
5999 switch (top_hmat_node_property)
6001 case HMatrixSupport::Property::general: {
6007 if (bc_node->get_data_reference().get_is_near_field())
6016 for (
unsigned int i = 0; i < hmat->
m; i++)
6018 for (
unsigned int j = 0; j < hmat->
n; j++)
6038 case HMatrixSupport::Property::symmetric: {
6047 case HMatrixSupport::BlockType::diagonal_block: {
6062 bc_node->get_data_reference().get_is_near_field(),
6064 "H-matrix node in the leaf set should belong to the near field if it is a diagonal block!"));
6071 hmat->
property == top_hmat_node_property,
6073 "A diagonal block should have the same property as that of the top level H-matrix node!"));
6079 LAPACKSupport::Property::symmetric);
6084 for (
unsigned int i = 0; i < hmat->
m; i++)
6086 for (
unsigned int j = 0; j < hmat->
n; j++)
6096 case HMatrixSupport::BlockType::lower_triangular_block: {
6104 if (bc_node->get_data_reference().get_is_near_field())
6113 for (
unsigned int i = 0; i < hmat->
m; i++)
6115 for (
unsigned int j = 0; j < hmat->
n; j++)
6135 case HMatrixSupport::BlockType::upper_triangular_block: {
6143 if (bc_node->get_data_reference().get_is_near_field())
6160 std::string(
"Invalid H-matrix block type: ") +
6161 std::string(HMatrixSupport::block_type_name(
6169 case HMatrixSupport::Property::hermite_symmetric: {
6178 case HMatrixSupport::BlockType::diagonal_block: {
6193 bc_node->get_data_reference().get_is_near_field(),
6195 "H-matrix node in the leaf set should belong to the near field if it is a diagonal block!"));
6202 hmat->
property == top_hmat_node_property,
6204 "A diagonal block should have the same property as that of the top level H-matrix node!"));
6210 LAPACKSupport::Property::hermite_symmetric);
6215 for (
unsigned int i = 0; i < hmat->
m; i++)
6217 for (
unsigned int j = 0; j < hmat->
n; j++)
6227 case HMatrixSupport::BlockType::lower_triangular_block: {
6235 if (bc_node->get_data_reference().get_is_near_field())
6244 for (
unsigned int i = 0; i < hmat->
m; i++)
6246 for (
unsigned int j = 0; j < hmat->
n; j++)
6266 case HMatrixSupport::BlockType::upper_triangular_block: {
6274 if (bc_node->get_data_reference().get_is_near_field())
6291 std::string(
"Invalid H-matrix block type: ") +
6292 std::string(HMatrixSupport::block_type_name(
6300 case HMatrixSupport::Property::lower_triangular: {
6309 case HMatrixSupport::BlockType::diagonal_block: {
6324 bc_node->get_data_reference().get_is_near_field(),
6326 "H-matrix node in the leaf set should belong to the near field if it is a diagonal block!"));
6333 hmat->
property == top_hmat_node_property,
6335 "A diagonal block should have the same property as that of the top level H-matrix node!"));
6341 LAPACKSupport::Property::lower_triangular);
6346 for (
unsigned int i = 0; i < hmat->
m; i++)
6348 for (
unsigned int j = 0; j < hmat->
n; j++)
6358 case HMatrixSupport::BlockType::lower_triangular_block: {
6366 if (bc_node->get_data_reference().get_is_near_field())
6375 for (
unsigned int i = 0; i < hmat->
m; i++)
6377 for (
unsigned int j = 0; j < hmat->
n; j++)
6397 case HMatrixSupport::BlockType::upper_triangular_block: {
6404 if (bc_node->get_data_reference().get_is_near_field())
6421 std::string(
"Invalid H-matrix block type: ") +
6422 std::string(HMatrixSupport::block_type_name(
6430 case HMatrixSupport::Property::upper_triangular: {
6439 case HMatrixSupport::BlockType::diagonal_block: {
6454 bc_node->get_data_reference().get_is_near_field(),
6456 "H-matrix node in the leaf set should belong to the near field if it is a diagonal block!"));
6463 hmat->
property == top_hmat_node_property,
6465 "A diagonal block should have the same property as that of the top level H-matrix node!"));
6471 LAPACKSupport::Property::upper_triangular);
6476 for (
unsigned int i = 0; i < hmat->
m; i++)
6478 for (
unsigned int j = 0; j < hmat->
n; j++)
6488 case HMatrixSupport::BlockType::upper_triangular_block: {
6496 if (bc_node->get_data_reference().get_is_near_field())
6505 for (
unsigned int i = 0; i < hmat->
m; i++)
6507 for (
unsigned int j = 0; j < hmat->
n; j++)
6527 case HMatrixSupport::BlockType::lower_triangular_block: {
6534 if (bc_node->get_data_reference().get_is_near_field())
6551 std::string(
"Invalid H-matrix block type: ") +
6552 std::string(HMatrixSupport::block_type_name(
6564 "Invalid property of the top level H-matrix node: ") +
6565 std::string(HMatrixSupport::property_name(
6566 top_hmat_node_property))));
6599template <
int spacedim,
typename Number =
double>
6604 typename numbers::NumberTraits<Number>::real_type>::
6605 node_const_pointer_type bc_node,
6608 HMatrixSupport::Property::general)
6615 typename numbers::NumberTraits<Number>::real_type
>::node_pointer_type>(
6621 hmat->
row_index_range =
const_cast<std::array<types::global_dof_index, 2> *
>(
6622 &(hmat->
bc_node->get_data_reference()
6624 ->get_data_reference()
6625 .get_index_range()));
6626 hmat->
col_index_range =
const_cast<std::array<types::global_dof_index, 2> *
>(
6627 &(hmat->
bc_node->get_data_reference()
6629 ->get_data_reference()
6630 .get_index_range()));
6638 const unsigned int bc_node_child_num = bc_node->get_child_num();
6640 if (bc_node_child_num > 0)
6649 for (
unsigned int i = 0; i < bc_node_child_num; i++)
6669 case HMatrixSupport::BlockType::undefined_block: {
6678 case HMatrixSupport::BlockType::diagonal_block: {
6689 HMatrixSupport::BlockType::diagonal_block;
6695 HMatrixSupport::BlockType::upper_triangular_block;
6701 HMatrixSupport::BlockType::lower_triangular_block;
6707 HMatrixSupport::BlockType::diagonal_block;
6712 Assert(
false, ExcNotImplemented());
6719 case HMatrixSupport::BlockType::upper_triangular_block: {
6728 case HMatrixSupport::BlockType::lower_triangular_block: {
6739 ExcMessage(
"Invalid H-matrix block type: " +
6751 case HMatrixSupport::Property::general: {
6756 child_hmat->
property = HMatrixSupport::Property::general;
6760 case HMatrixSupport::Property::symmetric: {
6767 HMatrixSupport::BlockType::diagonal_block)
6770 HMatrixSupport::Property::symmetric;
6774 child_hmat->
property = HMatrixSupport::Property::general;
6779 case HMatrixSupport::Property::hermite_symmetric: {
6786 HMatrixSupport::BlockType::diagonal_block)
6789 HMatrixSupport::Property::hermite_symmetric;
6793 child_hmat->
property = HMatrixSupport::Property::general;
6798 case HMatrixSupport::Property::upper_triangular: {
6806 HMatrixSupport::BlockType::diagonal_block)
6809 HMatrixSupport::Property::upper_triangular;
6813 child_hmat->
property = HMatrixSupport::Property::general;
6818 case HMatrixSupport::Property::lower_triangular: {
6826 HMatrixSupport::BlockType::diagonal_block)
6829 HMatrixSupport::Property::lower_triangular;
6833 child_hmat->
property = HMatrixSupport::Property::general;
6840 ExcMessage(
"Invalid H-matrix property: " +
6847 bc_node->get_child_pointer(i),
6849 top_hmat_node_property);
6860 child_hmat->
parent = hmat;
6876 switch (top_hmat_node_property)
6878 case HMatrixSupport::Property::general: {
6884 if (bc_node->get_data_reference().get_is_near_field())
6893 for (
unsigned int i = 0; i < hmat->
m; i++)
6895 for (
unsigned int j = 0; j < hmat->
n; j++)
6914 case HMatrixSupport::Property::symmetric: {
6923 case HMatrixSupport::BlockType::diagonal_block: {
6938 bc_node->get_data_reference().get_is_near_field(),
6940 "H-matrix node in the leaf set should belong to the near field if it is a diagonal block!"));
6947 hmat->
property == top_hmat_node_property,
6949 "A diagonal block should have the same property as that of the top level H-matrix node!"));
6955 LAPACKSupport::Property::symmetric);
6960 for (
unsigned int i = 0; i < hmat->
m; i++)
6962 for (
unsigned int j = 0; j < hmat->
n; j++)
6972 case HMatrixSupport::BlockType::lower_triangular_block: {
6980 if (bc_node->get_data_reference().get_is_near_field())
6989 for (
unsigned int i = 0; i < hmat->
m; i++)
6991 for (
unsigned int j = 0; j < hmat->
n; j++)
7010 case HMatrixSupport::BlockType::upper_triangular_block: {
7018 if (bc_node->get_data_reference().get_is_near_field())
7034 ExcInvalidHMatrixBlockType(hmat->
block_type));
7041 case HMatrixSupport::Property::hermite_symmetric: {
7050 case HMatrixSupport::BlockType::diagonal_block: {
7065 bc_node->get_data_reference().get_is_near_field(),
7067 "H-matrix node in the leaf set should belong to the near field if it is a diagonal block!"));
7074 hmat->
property == top_hmat_node_property,
7076 "A diagonal block should have the same property as that of the top level H-matrix node!"));
7082 LAPACKSupport::Property::hermite_symmetric);
7087 for (
unsigned int i = 0; i < hmat->
m; i++)
7089 for (
unsigned int j = 0; j < hmat->
n; j++)
7099 case HMatrixSupport::BlockType::lower_triangular_block: {
7107 if (bc_node->get_data_reference().get_is_near_field())
7116 for (
unsigned int i = 0; i < hmat->
m; i++)
7118 for (
unsigned int j = 0; j < hmat->
n; j++)
7137 case HMatrixSupport::BlockType::upper_triangular_block: {
7145 if (bc_node->get_data_reference().get_is_near_field())
7161 ExcInvalidHMatrixBlockType(hmat->
block_type));
7168 case HMatrixSupport::Property::lower_triangular: {
7177 case HMatrixSupport::BlockType::diagonal_block: {
7192 bc_node->get_data_reference().get_is_near_field(),
7194 "H-matrix node in the leaf set should belong to the near field if it is a diagonal block!"));
7201 hmat->
property == top_hmat_node_property,
7203 "A diagonal block should have the same property as that of the top level H-matrix node!"));
7209 LAPACKSupport::Property::lower_triangular);
7214 for (
unsigned int i = 0; i < hmat->
m; i++)
7216 for (
unsigned int j = 0; j < hmat->
n; j++)
7226 case HMatrixSupport::BlockType::lower_triangular_block: {
7234 if (bc_node->get_data_reference().get_is_near_field())
7243 for (
unsigned int i = 0; i < hmat->
m; i++)
7245 for (
unsigned int j = 0; j < hmat->
n; j++)
7264 case HMatrixSupport::BlockType::upper_triangular_block: {
7271 if (bc_node->get_data_reference().get_is_near_field())
7287 ExcInvalidHMatrixBlockType(hmat->
block_type));
7294 case HMatrixSupport::Property::upper_triangular: {
7303 case HMatrixSupport::BlockType::diagonal_block: {
7318 bc_node->get_data_reference().get_is_near_field(),
7320 "H-matrix node in the leaf set should belong to the near field if it is a diagonal block!"));
7327 hmat->
property == top_hmat_node_property,
7329 "A diagonal block should have the same property as that of the top level H-matrix node!"));
7335 LAPACKSupport::Property::upper_triangular);
7340 for (
unsigned int i = 0; i < hmat->
m; i++)
7342 for (
unsigned int j = 0; j < hmat->
n; j++)
7352 case HMatrixSupport::BlockType::upper_triangular_block: {
7360 if (bc_node->get_data_reference().get_is_near_field())
7369 for (
unsigned int i = 0; i < hmat->
m; i++)
7371 for (
unsigned int j = 0; j < hmat->
n; j++)
7390 case HMatrixSupport::BlockType::lower_triangular_block: {
7397 if (bc_node->get_data_reference().get_is_near_field())
7413 ExcInvalidHMatrixBlockType(hmat->
block_type));
7421 Assert(
false, ExcInvalidHMatrixProperty(top_hmat_node_property));
7457template <
int spacedim,
typename Number =
double>
7462 typename numbers::NumberTraits<Number>::real_type>::
7463 node_const_pointer_type bc_node,
7464 const unsigned int fixed_rank_k,
7466 const std::array<types::global_dof_index, 2> &M_row_index_range,
7467 const std::array<types::global_dof_index, 2> &M_col_index_range,
7469 HMatrixSupport::Property::general)
7477 const unsigned int bc_node_child_num = bc_node->get_child_num();
7479 if (bc_node_child_num > 0)
7488 for (
unsigned int i = 0; i < bc_node_child_num; i++)
7508 case HMatrixSupport::BlockType::undefined_block: {
7517 case HMatrixSupport::BlockType::diagonal_block: {
7528 HMatrixSupport::BlockType::diagonal_block;
7534 HMatrixSupport::BlockType::upper_triangular_block;
7540 HMatrixSupport::BlockType::lower_triangular_block;
7546 HMatrixSupport::BlockType::diagonal_block;
7551 Assert(
false, ExcNotImplemented());
7558 case HMatrixSupport::BlockType::upper_triangular_block: {
7567 case HMatrixSupport::BlockType::lower_triangular_block: {
7577 Assert(
false, ExcInvalidHMatrixBlockType(hmat->
block_type));
7588 case HMatrixSupport::Property::general: {
7593 child_hmat->
property = HMatrixSupport::Property::general;
7597 case HMatrixSupport::Property::symmetric: {
7604 HMatrixSupport::BlockType::diagonal_block)
7607 HMatrixSupport::Property::symmetric;
7611 child_hmat->
property = HMatrixSupport::Property::general;
7616 case HMatrixSupport::Property::hermite_symmetric: {
7623 HMatrixSupport::BlockType::diagonal_block)
7626 HMatrixSupport::Property::hermite_symmetric;
7630 child_hmat->
property = HMatrixSupport::Property::general;
7635 case HMatrixSupport::Property::upper_triangular: {
7643 HMatrixSupport::BlockType::diagonal_block)
7646 HMatrixSupport::Property::upper_triangular;
7650 child_hmat->
property = HMatrixSupport::Property::general;
7655 case HMatrixSupport::Property::lower_triangular: {
7663 HMatrixSupport::BlockType::diagonal_block)
7666 HMatrixSupport::Property::lower_triangular;
7670 child_hmat->
property = HMatrixSupport::Property::general;
7676 Assert(
false, ExcInvalidHMatrixProperty(hmat->
property));
7682 bc_node->get_child_pointer(i),
7687 top_hmat_node_property);
7698 child_hmat->
parent = hmat;
7714 switch (top_hmat_node_property)
7716 case HMatrixSupport::Property::general: {
7722 if (bc_node->get_data_reference().get_is_near_field())
7731 for (
unsigned int i = 0; i < hmat->
m; i++)
7733 for (
unsigned int j = 0; j < hmat->
n; j++)
7737 M_row_index_range[0] + i,
7739 M_col_index_range[0] + j);
7757 case HMatrixSupport::Property::symmetric: {
7766 case HMatrixSupport::BlockType::diagonal_block: {
7781 bc_node->get_data_reference().get_is_near_field(),
7783 "H-matrix node in the leaf set should belong to the near field if it is a diagonal block!"));
7790 hmat->
property == top_hmat_node_property,
7792 "A diagonal block should have the same property as that of the top level H-matrix node!"));
7798 LAPACKSupport::Property::symmetric);
7803 for (
unsigned int i = 0; i < hmat->
m; i++)
7805 for (
unsigned int j = 0; j < hmat->
n; j++)
7809 M_row_index_range[0] + i,
7811 M_col_index_range[0] + j);
7817 case HMatrixSupport::BlockType::lower_triangular_block: {
7825 if (bc_node->get_data_reference().get_is_near_field())
7834 for (
unsigned int i = 0; i < hmat->
m; i++)
7836 for (
unsigned int j = 0; j < hmat->
n; j++)
7840 M_row_index_range[0] + i,
7842 M_col_index_range[0] + j);
7860 case HMatrixSupport::BlockType::upper_triangular_block: {
7868 if (bc_node->get_data_reference().get_is_near_field())
7884 ExcInvalidHMatrixBlockType(hmat->
block_type));
7891 case HMatrixSupport::Property::hermite_symmetric: {
7900 case HMatrixSupport::BlockType::diagonal_block: {
7915 bc_node->get_data_reference().get_is_near_field(),
7917 "H-matrix node in the leaf set should belong to the near field if it is a diagonal block!"));
7924 hmat->
property == top_hmat_node_property,
7926 "A diagonal block should have the same property as that of the top level H-matrix node!"));
7932 LAPACKSupport::Property::hermite_symmetric);
7937 for (
unsigned int i = 0; i < hmat->
m; i++)
7939 for (
unsigned int j = 0; j < hmat->
n; j++)
7943 M_row_index_range[0] + i,
7945 M_col_index_range[0] + j);
7951 case HMatrixSupport::BlockType::lower_triangular_block: {
7959 if (bc_node->get_data_reference().get_is_near_field())
7968 for (
unsigned int i = 0; i < hmat->
m; i++)
7970 for (
unsigned int j = 0; j < hmat->
n; j++)
7974 M_row_index_range[0] + i,
7976 M_col_index_range[0] + j);
7994 case HMatrixSupport::BlockType::upper_triangular_block: {
8002 if (bc_node->get_data_reference().get_is_near_field())
8018 ExcInvalidHMatrixBlockType(hmat->
block_type));
8025 case HMatrixSupport::Property::lower_triangular: {
8034 case HMatrixSupport::BlockType::diagonal_block: {
8049 bc_node->get_data_reference().get_is_near_field(),
8051 "H-matrix node in the leaf set should belong to the near field if it is a diagonal block!"));
8058 hmat->
property == top_hmat_node_property,
8060 "A diagonal block should have the same property as that of the top level H-matrix node!"));
8066 LAPACKSupport::Property::lower_triangular);
8071 for (
unsigned int i = 0; i < hmat->
m; i++)
8073 for (
unsigned int j = 0; j < hmat->
n; j++)
8077 M_row_index_range[0] + i,
8079 M_col_index_range[0] + j);
8085 case HMatrixSupport::BlockType::lower_triangular_block: {
8093 if (bc_node->get_data_reference().get_is_near_field())
8102 for (
unsigned int i = 0; i < hmat->
m; i++)
8104 for (
unsigned int j = 0; j < hmat->
n; j++)
8108 M_row_index_range[0] + i,
8110 M_col_index_range[0] + j);
8128 case HMatrixSupport::BlockType::upper_triangular_block: {
8135 if (bc_node->get_data_reference().get_is_near_field())
8151 ExcInvalidHMatrixBlockType(hmat->
block_type));
8158 case HMatrixSupport::Property::upper_triangular: {
8167 case HMatrixSupport::BlockType::diagonal_block: {
8182 bc_node->get_data_reference().get_is_near_field(),
8184 "H-matrix node in the leaf set should belong to the near field if it is a diagonal block!"));
8191 hmat->
property == top_hmat_node_property,
8193 "A diagonal block should have the same property as that of the top level H-matrix node!"));
8199 LAPACKSupport::Property::upper_triangular);
8204 for (
unsigned int i = 0; i < hmat->
m; i++)
8206 for (
unsigned int j = 0; j < hmat->
n; j++)
8210 M_row_index_range[0] + i,
8212 M_col_index_range[0] + j);
8218 case HMatrixSupport::BlockType::upper_triangular_block: {
8226 if (bc_node->get_data_reference().get_is_near_field())
8235 for (
unsigned int i = 0; i < hmat->
m; i++)
8237 for (
unsigned int j = 0; j < hmat->
n; j++)
8241 M_row_index_range[0] + i,
8243 M_col_index_range[0] + j);
8261 case HMatrixSupport::BlockType::lower_triangular_block: {
8268 if (bc_node->get_data_reference().get_is_near_field())
8284 ExcInvalidHMatrixBlockType(hmat->
block_type));
8292 Assert(
false, ExcInvalidHMatrixProperty(top_hmat_node_property));
8316template <
int spacedim,
typename Number =
double>
8321 typename numbers::NumberTraits<Number>::real_type>::
8322 node_const_pointer_type bc_node,
8324 const std::array<types::global_dof_index, 2> &M_row_index_range,
8325 const std::array<types::global_dof_index, 2> &M_col_index_range,
8327 HMatrixSupport::Property::general)
8334 typename numbers::NumberTraits<Number>::real_type
>::node_pointer_type>(
8340 hmat->
row_index_range =
const_cast<std::array<types::global_dof_index, 2> *
>(
8341 &(hmat->
bc_node->get_data_reference()
8343 ->get_data_reference()
8344 .get_index_range()));
8345 hmat->
col_index_range =
const_cast<std::array<types::global_dof_index, 2> *
>(
8346 &(hmat->
bc_node->get_data_reference()
8348 ->get_data_reference()
8349 .get_index_range()));
8357 const unsigned int bc_node_child_num = bc_node->get_child_num();
8359 if (bc_node_child_num > 0)
8368 for (
unsigned int i = 0; i < bc_node_child_num; i++)
8388 case HMatrixSupport::BlockType::undefined_block: {
8397 case HMatrixSupport::BlockType::diagonal_block: {
8408 HMatrixSupport::BlockType::diagonal_block;
8414 HMatrixSupport::BlockType::upper_triangular_block;
8420 HMatrixSupport::BlockType::lower_triangular_block;
8426 HMatrixSupport::BlockType::diagonal_block;
8431 Assert(
false, ExcNotImplemented());
8438 case HMatrixSupport::BlockType::upper_triangular_block: {
8447 case HMatrixSupport::BlockType::lower_triangular_block: {
8457 Assert(
false, ExcInvalidHMatrixBlockType(hmat->
block_type));
8468 case HMatrixSupport::Property::general: {
8473 child_hmat->
property = HMatrixSupport::Property::general;
8477 case HMatrixSupport::Property::symmetric: {
8484 HMatrixSupport::BlockType::diagonal_block)
8487 HMatrixSupport::Property::symmetric;
8491 child_hmat->
property = HMatrixSupport::Property::general;
8496 case HMatrixSupport::Property::hermite_symmetric: {
8503 HMatrixSupport::BlockType::diagonal_block)
8506 HMatrixSupport::Property::hermite_symmetric;
8510 child_hmat->
property = HMatrixSupport::Property::general;
8515 case HMatrixSupport::Property::upper_triangular: {
8523 HMatrixSupport::BlockType::diagonal_block)
8526 HMatrixSupport::Property::upper_triangular;
8530 child_hmat->
property = HMatrixSupport::Property::general;
8535 case HMatrixSupport::Property::lower_triangular: {
8543 HMatrixSupport::BlockType::diagonal_block)
8546 HMatrixSupport::Property::lower_triangular;
8550 child_hmat->
property = HMatrixSupport::Property::general;
8556 Assert(
false, ExcInvalidHMatrixProperty(hmat->
property));
8562 bc_node->get_child_pointer(i),
8566 top_hmat_node_property);
8577 child_hmat->
parent = hmat;
8593 switch (top_hmat_node_property)
8595 case HMatrixSupport::Property::general: {
8601 if (bc_node->get_data_reference().get_is_near_field())
8610 for (
unsigned int i = 0; i < hmat->
m; i++)
8612 for (
unsigned int j = 0; j < hmat->
n; j++)
8616 M_row_index_range[0] + i,
8618 M_col_index_range[0] + j);
8635 case HMatrixSupport::Property::symmetric: {
8644 case HMatrixSupport::BlockType::diagonal_block: {
8659 bc_node->get_data_reference().get_is_near_field(),
8661 "H-matrix node in the leaf set should belong to the near field if it is a diagonal block!"));
8668 hmat->
property == top_hmat_node_property,
8670 "A diagonal block should have the same property as that of the top level H-matrix node!"));
8676 LAPACKSupport::Property::symmetric);
8681 for (
unsigned int i = 0; i < hmat->
m; i++)
8683 for (
unsigned int j = 0; j < hmat->
n; j++)
8687 M_row_index_range[0] + i,
8689 M_col_index_range[0] + j);
8695 case HMatrixSupport::BlockType::lower_triangular_block: {
8703 if (bc_node->get_data_reference().get_is_near_field())
8712 for (
unsigned int i = 0; i < hmat->
m; i++)
8714 for (
unsigned int j = 0; j < hmat->
n; j++)
8718 M_row_index_range[0] + i,
8720 M_col_index_range[0] + j);
8737 case HMatrixSupport::BlockType::upper_triangular_block: {
8745 if (bc_node->get_data_reference().get_is_near_field())
8761 ExcInvalidHMatrixBlockType(hmat->
block_type));
8768 case HMatrixSupport::Property::hermite_symmetric: {
8777 case HMatrixSupport::BlockType::diagonal_block: {
8792 bc_node->get_data_reference().get_is_near_field(),
8794 "H-matrix node in the leaf set should belong to the near field if it is a diagonal block!"));
8801 hmat->
property == top_hmat_node_property,
8803 "A diagonal block should have the same property as that of the top level H-matrix node!"));
8809 LAPACKSupport::Property::hermite_symmetric);
8814 for (
unsigned int i = 0; i < hmat->
m; i++)
8816 for (
unsigned int j = 0; j < hmat->
n; j++)
8820 M_row_index_range[0] + i,
8822 M_col_index_range[0] + j);
8828 case HMatrixSupport::BlockType::lower_triangular_block: {
8836 if (bc_node->get_data_reference().get_is_near_field())
8845 for (
unsigned int i = 0; i < hmat->
m; i++)
8847 for (
unsigned int j = 0; j < hmat->
n; j++)
8851 M_row_index_range[0] + i,
8853 M_col_index_range[0] + j);
8870 case HMatrixSupport::BlockType::upper_triangular_block: {
8878 if (bc_node->get_data_reference().get_is_near_field())
8894 ExcInvalidHMatrixBlockType(hmat->
block_type));
8901 case HMatrixSupport::Property::lower_triangular: {
8910 case HMatrixSupport::BlockType::diagonal_block: {
8925 bc_node->get_data_reference().get_is_near_field(),
8927 "H-matrix node in the leaf set should belong to the near field if it is a diagonal block!"));
8934 hmat->
property == top_hmat_node_property,
8936 "A diagonal block should have the same property as that of the top level H-matrix node!"));
8942 LAPACKSupport::Property::lower_triangular);
8947 for (
unsigned int i = 0; i < hmat->
m; i++)
8949 for (
unsigned int j = 0; j < hmat->
n; j++)
8953 M_row_index_range[0] + i,
8955 M_col_index_range[0] + j);
8961 case HMatrixSupport::BlockType::lower_triangular_block: {
8969 if (bc_node->get_data_reference().get_is_near_field())
8978 for (
unsigned int i = 0; i < hmat->
m; i++)
8980 for (
unsigned int j = 0; j < hmat->
n; j++)
8984 M_row_index_range[0] + i,
8986 M_col_index_range[0] + j);
9003 case HMatrixSupport::BlockType::upper_triangular_block: {
9010 if (bc_node->get_data_reference().get_is_near_field())
9026 ExcInvalidHMatrixBlockType(hmat->
block_type));
9033 case HMatrixSupport::Property::upper_triangular: {
9042 case HMatrixSupport::BlockType::diagonal_block: {
9057 bc_node->get_data_reference().get_is_near_field(),
9059 "H-matrix node in the leaf set should belong to the near field if it is a diagonal block!"));
9066 hmat->
property == top_hmat_node_property,
9068 "A diagonal block should have the same property as that of the top level H-matrix node!"));
9074 LAPACKSupport::Property::upper_triangular);
9079 for (
unsigned int i = 0; i < hmat->
m; i++)
9081 for (
unsigned int j = 0; j < hmat->
n; j++)
9085 M_row_index_range[0] + i,
9087 M_col_index_range[0] + j);
9093 case HMatrixSupport::BlockType::upper_triangular_block: {
9101 if (bc_node->get_data_reference().get_is_near_field())
9110 for (
unsigned int i = 0; i < hmat->
m; i++)
9112 for (
unsigned int j = 0; j < hmat->
n; j++)
9116 M_row_index_range[0] + i,
9118 M_col_index_range[0] + j);
9135 case HMatrixSupport::BlockType::lower_triangular_block: {
9142 if (bc_node->get_data_reference().get_is_near_field())
9158 ExcInvalidHMatrixBlockType(hmat->
block_type));
9166 Assert(
false, ExcInvalidHMatrixProperty(top_hmat_node_property));
9187template <
int spacedim,
typename Number =
double>
9192 typename numbers::NumberTraits<Number>::real_type>::
9193 node_const_pointer_type bc_node,
9202 typename numbers::NumberTraits<Number>::real_type
>::node_pointer_type>(
9209 hmat->
row_index_range =
const_cast<std::array<types::global_dof_index, 2> *
>(
9210 &(hmat->
bc_node->get_data_reference()
9212 ->get_data_reference()
9213 .get_index_range()));
9214 hmat->
col_index_range =
const_cast<std::array<types::global_dof_index, 2> *
>(
9215 &(hmat->
bc_node->get_data_reference()
9217 ->get_data_reference()
9218 .get_index_range()));
9226 const unsigned int bc_node_child_num = bc_node->get_child_num();
9228 if (bc_node_child_num > 0)
9239 for (
unsigned int i = 0; i < bc_node_child_num; i++)
9259 case HMatrixSupport::BlockType::undefined_block: {
9268 case HMatrixSupport::BlockType::diagonal_block: {
9279 HMatrixSupport::BlockType::diagonal_block;
9285 HMatrixSupport::BlockType::upper_triangular_block;
9291 HMatrixSupport::BlockType::lower_triangular_block;
9297 HMatrixSupport::BlockType::diagonal_block;
9302 Assert(
false, ExcNotImplemented());
9309 case HMatrixSupport::BlockType::upper_triangular_block: {
9318 case HMatrixSupport::BlockType::lower_triangular_block: {
9328 Assert(
false, ExcInvalidHMatrixBlockType(hmat->
block_type));
9339 case HMatrixSupport::Property::general: {
9344 child_hmat->
property = HMatrixSupport::Property::general;
9348 case HMatrixSupport::Property::symmetric: {
9355 HMatrixSupport::BlockType::diagonal_block)
9358 HMatrixSupport::Property::symmetric;
9362 child_hmat->
property = HMatrixSupport::Property::general;
9367 case HMatrixSupport::Property::hermite_symmetric: {
9374 HMatrixSupport::BlockType::diagonal_block)
9377 HMatrixSupport::Property::hermite_symmetric;
9381 child_hmat->
property = HMatrixSupport::Property::general;
9386 case HMatrixSupport::Property::upper_triangular: {
9394 HMatrixSupport::BlockType::diagonal_block)
9397 HMatrixSupport::Property::upper_triangular;
9401 child_hmat->
property = HMatrixSupport::Property::general;
9406 case HMatrixSupport::Property::lower_triangular: {
9414 HMatrixSupport::BlockType::diagonal_block)
9417 HMatrixSupport::Property::lower_triangular;
9421 child_hmat->
property = HMatrixSupport::Property::general;
9427 Assert(
false, ExcInvalidHMatrixProperty(hmat->
property));
9433 bc_node->get_child_pointer(i),
9445 child_hmat->
parent = hmat;
9457 H.find_block_cluster_in_leaf_set(hmat->
bc_node->get_data_reference()));
9462 (*hmat) = std::move(*matched_source_hmat);
9481template <
int spacedim,
typename Number>
9497 ExcInvalidHMatrixType(starting_hmat->
type));
9506 const unsigned int bc_node_child_num = current_hmat->
bc_node->get_child_num();
9508 if (bc_node_child_num > 0)
9525 if (current_hmat != starting_hmat)
9530 for (
unsigned int i = 0; i < bc_node_child_num; i++)
9552 case HMatrixSupport::BlockType::undefined_block: {
9561 case HMatrixSupport::BlockType::diagonal_block: {
9572 HMatrixSupport::BlockType::diagonal_block;
9578 HMatrixSupport::BlockType::upper_triangular_block;
9584 HMatrixSupport::BlockType::lower_triangular_block;
9590 HMatrixSupport::BlockType::diagonal_block;
9595 Assert(
false, ExcNotImplemented());
9602 case HMatrixSupport::BlockType::upper_triangular_block: {
9611 case HMatrixSupport::BlockType::lower_triangular_block: {
9622 ExcMessage(
"Invalid H-matrix block type: " +
9634 case HMatrixSupport::Property::general: {
9639 child_hmat->
property = HMatrixSupport::Property::general;
9643 case HMatrixSupport::Property::symmetric: {
9650 HMatrixSupport::BlockType::diagonal_block)
9653 HMatrixSupport::Property::symmetric;
9657 child_hmat->
property = HMatrixSupport::Property::general;
9662 case HMatrixSupport::Property::hermite_symmetric: {
9669 HMatrixSupport::BlockType::diagonal_block)
9672 HMatrixSupport::Property::hermite_symmetric;
9676 child_hmat->
property = HMatrixSupport::Property::general;
9681 case HMatrixSupport::Property::upper_triangular: {
9689 HMatrixSupport::BlockType::diagonal_block)
9692 HMatrixSupport::Property::upper_triangular;
9696 child_hmat->
property = HMatrixSupport::Property::general;
9701 case HMatrixSupport::Property::lower_triangular: {
9709 HMatrixSupport::BlockType::diagonal_block)
9712 HMatrixSupport::Property::lower_triangular;
9716 child_hmat->
property = HMatrixSupport::Property::general;
9723 ExcMessage(
"Invalid H-matrix property: " +
9724 std::to_string(current_hmat->
property)));
9735 child_hmat->
bc_node =
const_cast<
9737 typename numbers::NumberTraits<
9738 Number
>::real_type>::node_pointer_type>(
9739 current_hmat->
bc_node->get_child_pointer(i));
9746 const_cast<std::array<types::global_dof_index, 2> *
>(
9747 &(child_hmat->
bc_node->get_data_reference()
9749 ->get_data_reference()
9750 .get_index_range()));
9752 const_cast<std::array<types::global_dof_index, 2> *
>(
9753 &(child_hmat->
bc_node->get_data_reference()
9755 ->get_data_reference()
9756 .get_index_range()));
9771 child_hmat->
parent = current_hmat;
9787 if (current_hmat == starting_hmat)
9808 if (current_hmat->
bc_node->get_data_reference().get_is_near_field())
9817 switch (starting_hmat->
type)
9839 starting_hmat->
rkmatrix->restrictToFullMatrix(
9849 Assert(
false, ExcInvalidHMatrixType(starting_hmat->
type));
9865 HMatrixSupport::BlockType::diagonal_block)
9869 case HMatrixSupport::Property::general: {
9871 LAPACKSupport::Property::general);
9875 case HMatrixSupport::Property::symmetric: {
9877 LAPACKSupport::Property::symmetric);
9881 case HMatrixSupport::Property::hermite_symmetric: {
9883 LAPACKSupport::Property::hermite_symmetric);
9887 case HMatrixSupport::Property::upper_triangular: {
9889 LAPACKSupport::Property::upper_triangular);
9893 case HMatrixSupport::Property::lower_triangular: {
9895 LAPACKSupport::Property::lower_triangular);
9902 "Invalid H-matrix property: " +
9903 std::to_string(current_hmat->
property)));
9917 switch (starting_hmat->
type)
9946 Assert(
false, ExcInvalidHMatrixType(starting_hmat->
type));
10015template <
int spacedim,
typename Number =
double>
10019 const unsigned int fixed_rank_k,
10021 size_t *calling_counter =
nullptr,
10022 const std::string &output_file_base_name = std::string(
"hmat-bct"))
10032 ExcInvalidHMatrixType(hmat_block->
type));
10034 if (hmat_block->
bc_node->is_leaf())
10040 if (hmat_block->
bc_node->get_data_reference().get_is_near_field())
10050 ExcInvalidHMatrixType(hmat_block->
type));
10061 ExcInvalidHMatrixType(hmat_block->
type));
10063 hmat_block->
rkmatrix->truncate_to_rank(fixed_rank_k);
10079 output_file_base_name);
10082 if (hmat_block->
bc_node->get_data_reference().get_is_near_field())
10140 ExcInvalidHMatrixType(submatrix->
type));
10145 switch (hmat_block->
bc_node->get_split_mode())
10147 case CrossSplitMode: {
10148 AssertDimension(hmat_block->
submatrices.size(), 4);
10158 case HorizontalSplitMode: {
10159 AssertDimension(hmat_block->
submatrices.size(), 2);
10168 case VerticalSplitMode: {
10169 AssertDimension(hmat_block->
submatrices.size(), 2);
10182 std::string(
"Invalid block cluster splitting mode: ") +
10183 std::to_string(hmat_block->
bc_node->get_split_mode())));
10190 if (submatrix !=
nullptr)
10210 switch (hmat_block->
bc_node->get_split_mode())
10212 case CrossSplitMode: {
10213 AssertDimension(hmat_block->
submatrices.size(), 4);
10267 Assert(
false, ExcInternalError());
10272 case HorizontalSplitMode: {
10273 AssertDimension(hmat_block->
submatrices.size(), 2);
10315 Assert(
false, ExcInternalError());
10320 case VerticalSplitMode: {
10321 AssertDimension(hmat_block->
submatrices.size(), 2);
10363 Assert(
false, ExcInternalError());
10372 std::string(
"Invalid block cluster splitting mode: ") +
10373 std::to_string(hmat_block->
bc_node->get_split_mode())));
10380 if (submatrix !=
nullptr)
10396 if (hmat_root_block !=
nullptr && calling_counter !=
nullptr)
10398 std::ofstream output_stream(
10399 output_file_base_name + std::to_string(*calling_counter) +
".dat");
10400 hmat_root_block->write_leaf_set(output_stream);
10401 output_stream.close();
10403 (*calling_counter) = (*calling_counter) + 1;
10442template <
int spacedim,
typename Number =
double>
10448 AssertDimension(M1.
n, M2.
m);
10457 Vector<Number> col_vect_in_A(M2.A.m());
10458 Vector<Number> result_vect(M1.
m);
10473 M2.A.get_column(j, col_vect_in_A);
10474 result_vect = Number(0.);
10480 M.A.fill_col(j, result_vect);
10516template <
int spacedim,
typename Number =
double>
10523 AssertDimension(M1.
n, M2.
m);
10532 Vector<Number> col_vect_in_A(M2.A.m());
10533 Vector<Number> result_vect(M1.
m);
10548 M2.A.get_column(j, col_vect_in_A);
10553 result_vect = Number(0.);
10559 M.A.fill_col(j, result_vect);
10599template <
int spacedim,
typename Number =
double>
10605 AssertDimension(M1.
n, M2.
n);
10614 Vector<Number> col_vect_in_B(M2.B.m());
10615 Vector<Number> result_vect(M1.
m);
10630 M2.B.get_column(j, col_vect_in_B);
10631 result_vect = Number(0.);
10637 M.A.fill_col(j, result_vect);
10670template <
int spacedim,
typename Number =
double>
10677 AssertDimension(M1.
n, M2.
n);
10686 Vector<Number> col_vect_in_B(M2.B.m());
10687 Vector<Number> result_vect(M1.
m);
10702 M2.B.get_column(j, col_vect_in_B);
10703 result_vect = Number(0.);
10709 M.A.fill_col(j, result_vect);
10749template <
int spacedim,
typename Number =
double>
10755 AssertDimension(M1.
m, M2.
m);
10764 Vector<Number> col_vect_in_A(M2.A.m());
10765 Vector<Number> result_vect(M1.
n);
10780 M2.A.get_column(j, col_vect_in_A);
10781 result_vect = Number(0.);
10787 M.A.fill_col(j, result_vect);
10830template <
int spacedim,
typename Number =
double>
10837 AssertDimension(M1.
m, M2.
m);
10846 Vector<Number> col_vect_in_A(M2.A.m());
10847 Vector<Number> result_vect(M1.
n);
10862 M2.A.get_column(j, col_vect_in_A);
10863 result_vect = Number(0.);
10869 M.A.fill_col(j, result_vect);
10888template <
int spacedim,
typename Number =
double>
10893 bool is_M1M2_last_in_M_Sigma_P =
true)
10896 Assert(M2->
rkmatrix, ExcInternalError());
10900 AssertDimension(M1->
n, M2->
m);
10905 if (is_M1M2_last_in_M_Sigma_P)
10923 AssertDimension(M->
Sigma_F.size(), 0);
10957template <
int spacedim,
typename Number =
double>
10963 AssertDimension(M1.
n, M2.
m);
10972 Vector<Number> col_vect_in_B(M1.B.m());
10973 Vector<Number> result_vect(M2.
n);
10988 M1.B.get_column(j, col_vect_in_B);
10989 result_vect = Number(0.);
10995 M.B.fill_col(j, result_vect);
11036template <
int spacedim,
typename Number =
double>
11043 AssertDimension(M1.
n, M2.
m);
11052 Vector<Number> col_vect_in_B(M1.B.m());
11053 Vector<Number> result_vect(M2.
n);
11068 M1.B.get_column(j, col_vect_in_B);
11073 result_vect = Number(0.);
11079 M.B.fill_col(j, result_vect);
11117template <
int spacedim,
typename Number =
double>
11123 AssertDimension(M1.
n, M2.
n);
11132 Vector<Number> col_vect_in_B(M1.B.m());
11133 Vector<Number> result_vect(M2.
m);
11148 M1.B.get_column(j, col_vect_in_B);
11149 result_vect = Number(0.);
11155 M.B.fill_col(j, result_vect);
11192template <
int spacedim,
typename Number =
double>
11199 AssertDimension(M1.
n, M2.
n);
11208 Vector<Number> col_vect_in_B(M1.B.m());
11209 Vector<Number> result_vect(M2.
m);
11224 M1.B.get_column(j, col_vect_in_B);
11225 result_vect = Number(0.);
11231 M.B.fill_col(j, result_vect);
11271template <
int spacedim,
typename Number =
double>
11277 AssertDimension(M1.
m, M2.
m);
11286 Vector<Number> col_vect_in_A(M1.A.m());
11287 Vector<Number> result_vect(M2.
n);
11302 M1.A.get_column(j, col_vect_in_A);
11303 result_vect = Number(0.);
11309 M.B.fill_col(j, result_vect);
11352template <
int spacedim,
typename Number =
double>
11359 AssertDimension(M1.
m, M2.
m);
11368 Vector<Number> col_vect_in_A(M1.A.m());
11369 Vector<Number> result_vect(M2.
n);
11384 M1.A.get_column(j, col_vect_in_A);
11385 result_vect = Number(0.);
11391 M.B.fill_col(j, result_vect);
11409template <
int spacedim,
typename Number =
double>
11414 bool is_M1M2_last_in_M_Sigma_P =
true)
11417 Assert(M1->
rkmatrix, ExcInternalError());
11421 AssertDimension(M1->
n, M2->
m);
11426 if (is_M1M2_last_in_M_Sigma_P)
11444 AssertDimension(M->
Sigma_F.size(), 0);
11458template <
int spacedim,
typename Number =
double>
11464 AssertDimension(M1.
n, M2.m());
11466 Vector<Number> col_vect_in_M2(M2.m());
11467 Vector<Number> result_vect(M1.
m);
11472 M.reinit(n_rows, n_cols);
11476 result_vect = Number(0.);
11494template <
int spacedim,
typename Number =
double>
11501 AssertDimension(M1.
n, M2.m());
11503 Vector<Number> col_vect_in_M2(M2.m());
11504 Vector<Number> result_vect(M1.
m);
11509 M.reinit(n_rows, n_cols);
11513 result_vect = Number(0.);
11530template <
int spacedim,
typename Number =
double>
11536 AssertDimension(M1.
n, M2.n());
11538 Vector<Number> row_vect_in_M2(M2.n());
11539 Vector<Number> result_vect(M1.
m);
11544 M.reinit(n_rows, n_cols);
11547 M2.
get_row(j, row_vect_in_M2);
11548 result_vect = Number(0.);
11565template <
int spacedim,
typename Number =
double>
11572 AssertDimension(M1.
n, M2.n());
11574 Vector<Number> row_vect_in_M2(M2.n());
11575 Vector<Number> result_vect(M1.
m);
11580 M.reinit(n_rows, n_cols);
11583 M2.
get_row(j, row_vect_in_M2);
11584 result_vect = Number(0.);
11601template <
int spacedim,
typename Number =
double>
11607 AssertDimension(M1.
m, M2.m());
11609 Vector<Number> col_vect_in_M2(M2.m());
11610 Vector<Number> result_vect(M1.
n);
11615 M.reinit(n_rows, n_cols);
11619 result_vect = Number(0.);
11626template <
int spacedim,
typename Number =
double>
11633 AssertDimension(M1.
m, M2.m());
11635 Vector<Number> col_vect_in_M2(M2.m());
11636 Vector<Number> result_vect(M1.
n);
11641 M.reinit(n_rows, n_cols);
11645 result_vect = Number(0.);
11667template <
int spacedim,
typename Number =
double>
11673 AssertDimension(M1.
n, M2.m());
11705template <
int spacedim,
typename Number =
double>
11712 AssertDimension(M1.
n, M2.m());
11744template <
int spacedim,
typename Number =
double>
11750 AssertDimension(M1.
n, M2.n());
11782template <
int spacedim,
typename Number =
double>
11789 AssertDimension(M1.
n, M2.n());
11821template <
int spacedim,
typename Number =
double>
11827 AssertDimension(M1.
m, M2.m());
11860template <
int spacedim,
typename Number =
double>
11867 AssertDimension(M1.
m, M2.m());
11892template <
int spacedim,
typename Number =
double>
11897 bool is_M1M2_last_in_M_Sigma_P =
true)
11904 AssertDimension(M1->
n, M2->
m);
11909 if (is_M1M2_last_in_M_Sigma_P)
11918 if (M->
bc_node->get_data_reference().get_is_near_field())
11925 M->
Sigma_F.push_back(M_full);
11930 AssertDimension(M->
Sigma_R.size(), 0);
11947 AssertDimension(M->
Sigma_F.size(), 0);
11962template <
int spacedim,
typename Number =
double>
11968 AssertDimension(M1.n(), M2.
m);
11970 Vector<Number> row_vect_in_M1(M1.n());
11971 Vector<Number> result_vect(M2.
n);
11976 M.reinit(n_rows, n_cols);
11979 M1.
get_row(i, row_vect_in_M1);
11980 result_vect = Number(0.);
11997template <
int spacedim,
typename Number =
double>
12004 AssertDimension(M1.n(), M2.
m);
12006 Vector<Number> row_vect_in_M1(M1.n());
12007 Vector<Number> result_vect(M2.
n);
12012 M.reinit(n_rows, n_cols);
12015 M1.
get_row(i, row_vect_in_M1);
12020 result_vect = Number(0.);
12036template <
int spacedim,
typename Number =
double>
12042 AssertDimension(M1.n(), M2.
n);
12044 Vector<Number> row_vect_in_M1(M1.n());
12045 Vector<Number> result_vect(M2.
m);
12050 M.reinit(n_rows, n_cols);
12053 M1.
get_row(i, row_vect_in_M1);
12054 result_vect = Number(0.);
12071template <
int spacedim,
typename Number =
double>
12078 AssertDimension(M1.n(), M2.
n);
12080 Vector<Number> row_vect_in_M1(M1.n());
12081 Vector<Number> result_vect(M2.
m);
12086 M.reinit(n_rows, n_cols);
12089 M1.
get_row(i, row_vect_in_M1);
12090 result_vect = Number(0.);
12105template <
int spacedim,
typename Number =
double>
12111 AssertDimension(M1.m(), M2.
m);
12113 Vector<Number> col_vect_in_M1(M1.m());
12114 Vector<Number> result_vect(M2.
n);
12119 M.reinit(n_rows, n_cols);
12123 result_vect = Number(0.);
12139template <
int spacedim,
typename Number =
double>
12146 AssertDimension(M1.m(), M2.
m);
12148 Vector<Number> col_vect_in_M1(M1.m());
12149 Vector<Number> result_vect(M2.
n);
12154 M.reinit(n_rows, n_cols);
12158 result_vect = Number(0.);
12173template <
int spacedim,
typename Number =
double>
12179 AssertDimension(M1.n(), M2.
m);
12201template <
int spacedim,
typename Number =
double>
12208 AssertDimension(M1.n(), M2.
m);
12229template <
int spacedim,
typename Number =
double>
12235 AssertDimension(M1.n(), M2.
n);
12257template <
int spacedim,
typename Number =
double>
12264 AssertDimension(M1.n(), M2.
n);
12285template <
int spacedim,
typename Number =
double>
12291 AssertDimension(M1.m(), M2.
m);
12312template <
int spacedim,
typename Number =
double>
12319 AssertDimension(M1.m(), M2.
m);
12340template <
int spacedim,
typename Number =
double>
12345 bool is_M1M2_last_in_M_Sigma_P =
true)
12352 AssertDimension(M1->
n, M2->
m);
12357 if (is_M1M2_last_in_M_Sigma_P)
12366 if (M->
bc_node->get_data_reference().get_is_near_field())
12373 M->
Sigma_F.push_back(M_full);
12378 AssertDimension(M->
Sigma_R.size(), 0);
12395 AssertDimension(M->
Sigma_F.size(), 0);
12401template <
int spacedim,
typename Number =
double>
12405 BlockClusterTree<spacedim,
typename numbers::NumberTraits<Number>::real_type>
12419 switch (split_mode_of_mm)
12421 case HorizontalSplitMode: {
12427 "For level conserving H-matrix multiplication, HorizontalSplitMode should not appear!"));
12431 case VerticalSplitMode: {
12437 "For level conserving H-matrix multiplication, VerticalSplitMode should not appear!"));
12441 case CrossSplitMode: {
12450 "Inconsistent case met during H-matrix MM multiplication"));
12463 AssertDimension(M->
Sigma_P.size(), 0);
12472template <
int spacedim,
typename Number =
double>
12476 BlockClusterTree<spacedim,
typename numbers::NumberTraits<Number>::real_type>
12478 const unsigned int fixed_rank)
12490 AssertDimension(hmat->
Sigma_P.size(), 0);
12505 "The pointer hmat->rkmatrix should be nullptr before the following assignment:\n\nhmat->rkmatrix = hmat->Sigma_R[0];\n"));
12507 for (
size_t i = 1; i < hmat->
Sigma_R.size(); i++)
12523 ExcInvalidHMatrixType(hmat->
type));
12528 "The pointer hmat->fullmatrix should be nullptr before the following assignment:\n\nhmat->fullmatrix = hmat->Sigma_F[0];\n"));
12530 for (
size_t i = 1; i < hmat->
Sigma_F.size(); i++)
12545 Assert(
false, ExcInternalError());
12590template <
int spacedim,
typename Number>
12597 const unsigned int fixed_rank,
12598 const bool is_result_matrix_store_tril_only =
false)
12604 Assert(M0.
bc_node->is_leaf(), ExcMessage(
"M0 should be a leaf node!"));
12606 if (is_result_matrix_store_tril_only)
12608 Assert(M0.
get_property() == HMatrixSupport::Property::symmetric ||
12610 HMatrixSupport::Property::hermite_symmetric ||
12611 M0.
get_property() == HMatrixSupport::Property::lower_triangular,
12613 Assert(M0.
get_block_type() == HMatrixSupport::BlockType::diagonal_block,
12615 Assert(M.
get_property() == HMatrixSupport::Property::symmetric ||
12617 HMatrixSupport::Property::hermite_symmetric ||
12618 M.
get_property() == HMatrixSupport::Property::lower_triangular,
12620 Assert(M.
get_block_type() == HMatrixSupport::BlockType::diagonal_block,
12629 typename numbers::NumberTraits<Number>::real_type>::node_pointer_type,
12632 typename numbers::NumberTraits<Number>::real_type>::child_num>
12633 empty_child_pointers{{
nullptr,
nullptr,
nullptr,
nullptr}};
12641 typename numbers::NumberTraits<Number>::real_type>::
12642 node_value_type current_product_bc_node(
12643 BlockCluster<spacedim,
typename numbers::NumberTraits<Number>::real_type>(
12644 M1.
bc_node->get_data_reference().get_tau_node(),
12645 M2.
bc_node->get_data_reference().get_sigma_node()),
12647 empty_child_pointers,
12656 if (M0.
bc_node->get_data_reference().get_is_near_field())
12660 current_product_bc_node.get_data_reference().set_is_near_field(
true);
12666 current_product_bc_node.get_data_reference().set_is_near_field(
false);
12677 bool is_result_matrix_Z_store_tril_only =
false;
12679 if (is_result_matrix_store_tril_only &&
12687 is_result_matrix_Z_store_tril_only =
true;
12694 Assert(block_type_for_local_Z ==
12695 HMatrixSupport::BlockType::diagonal_block,
12696 ExcInvalidHMatrixBlockType(block_type_for_local_Z));
12707 block_type_for_local_Z);
12745 Assert(
false, ExcInternalError());
12763 Assert(
false, ExcInvalidHMatrixType(result_matrix_type));
12780 Assert(
false, ExcInvalidHMatrixType(result_matrix_type));
12790 if (is_result_matrix_Z_store_tril_only)
12794 case HMatrixSupport::Property::symmetric: {
12796 LAPACKSupport::Property::symmetric);
12800 case HMatrixSupport::Property::hermite_symmetric: {
12802 LAPACKSupport::Property::hermite_symmetric);
12806 case HMatrixSupport::Property::lower_triangular: {
12808 LAPACKSupport::Property::lower_triangular);
12813 Assert(
false, ExcInvalidHMatrixProperty(Z.
property));
12822 Assert(
false, ExcInvalidHMatrixType(Z.
type));
12835 const unsigned int local_fixed_rank =
12836 std::min(fixed_rank * 2, std::min(Z.
m, Z.
n));
12840 typename numbers::NumberTraits<
12841 Number>::real_type>::child_num>
12842 block_types_for_submatrices_of_local_Z;
12843 HMatrixSupport::infer_submatrix_block_types_from_parent_hmat(
12844 block_type_for_local_Z, block_types_for_submatrices_of_local_Z);
12850 block_types_for_submatrices_of_local_Z[0],
12852 is_result_matrix_Z_store_tril_only);
12857 block_types_for_submatrices_of_local_Z[0],
12859 is_result_matrix_Z_store_tril_only);
12861 if ((!is_result_matrix_Z_store_tril_only) ||
12862 (is_result_matrix_Z_store_tril_only &&
12863 Z.
property != HMatrixSupport::Property::symmetric &&
12864 Z.
property != HMatrixSupport::Property::hermite_symmetric &&
12865 Z.
property != HMatrixSupport::Property::lower_triangular))
12881 block_types_for_submatrices_of_local_Z[1],
12883 is_result_matrix_Z_store_tril_only);
12888 block_types_for_submatrices_of_local_Z[1],
12890 is_result_matrix_Z_store_tril_only);
12897 block_types_for_submatrices_of_local_Z[2],
12899 is_result_matrix_Z_store_tril_only);
12904 block_types_for_submatrices_of_local_Z[2],
12906 is_result_matrix_Z_store_tril_only);
12912 block_types_for_submatrices_of_local_Z[3],
12914 is_result_matrix_Z_store_tril_only);
12919 block_types_for_submatrices_of_local_Z[3],
12921 is_result_matrix_Z_store_tril_only);
12927 if (M0.
bc_node->get_data_reference().get_is_near_field())
12935 if ((!is_result_matrix_store_tril_only) ||
12936 (is_result_matrix_store_tril_only &&
12937 M.
block_type != HMatrixSupport::BlockType::upper_triangular_block &&
12938 Z.
block_type != HMatrixSupport::BlockType::upper_triangular_block))
12958 Assert(M.
rkmatrix, ExcInternalError());
12960 if ((!is_result_matrix_store_tril_only) ||
12961 (is_result_matrix_store_tril_only &&
12962 M.
block_type != HMatrixSupport::BlockType::upper_triangular_block &&
12963 Z.
block_type != HMatrixSupport::BlockType::upper_triangular_block))
13008template <
int spacedim,
typename Number>
13012 const Number alpha,
13016 const unsigned int fixed_rank,
13017 const bool is_result_matrix_store_tril_only =
false)
13023 Assert(M0.
bc_node->is_leaf(), ExcMessage(
"M0 should be a leaf node!"));
13025 if (is_result_matrix_store_tril_only)
13027 Assert(M0.
get_property() == HMatrixSupport::Property::symmetric ||
13029 HMatrixSupport::Property::hermite_symmetric ||
13030 M0.
get_property() == HMatrixSupport::Property::lower_triangular,
13032 Assert(M0.
get_block_type() == HMatrixSupport::BlockType::diagonal_block,
13034 Assert(M.
get_property() == HMatrixSupport::Property::symmetric ||
13036 HMatrixSupport::Property::hermite_symmetric ||
13037 M.
get_property() == HMatrixSupport::Property::lower_triangular,
13039 Assert(M.
get_block_type() == HMatrixSupport::BlockType::diagonal_block,
13048 typename numbers::NumberTraits<Number>::real_type>::node_pointer_type,
13051 typename numbers::NumberTraits<Number>::real_type>::child_num>
13052 empty_child_pointers{{
nullptr,
nullptr,
nullptr,
nullptr}};
13060 typename numbers::NumberTraits<Number>::real_type>::
13061 node_value_type current_product_bc_node(
13062 BlockCluster<spacedim,
typename numbers::NumberTraits<Number>::real_type>(
13063 M1.
bc_node->get_data_reference().get_tau_node(),
13064 M2.
bc_node->get_data_reference().get_sigma_node()),
13066 empty_child_pointers,
13075 if (M0.
bc_node->get_data_reference().get_is_near_field())
13079 current_product_bc_node.get_data_reference().set_is_near_field(
true);
13085 current_product_bc_node.get_data_reference().set_is_near_field(
false);
13096 bool is_result_matrix_Z_store_tril_only =
false;
13098 if (is_result_matrix_store_tril_only &&
13106 is_result_matrix_Z_store_tril_only =
true;
13113 Assert(block_type_for_local_Z ==
13114 HMatrixSupport::BlockType::diagonal_block,
13115 ExcInvalidHMatrixBlockType(block_type_for_local_Z));
13127 block_type_for_local_Z);
13165 Assert(
false, ExcInternalError());
13183 Assert(
false, ExcInvalidHMatrixType(result_matrix_type));
13200 Assert(
false, ExcInvalidHMatrixType(result_matrix_type));
13210 if (is_result_matrix_Z_store_tril_only)
13214 case HMatrixSupport::Property::symmetric: {
13216 LAPACKSupport::Property::symmetric);
13220 case HMatrixSupport::Property::hermite_symmetric: {
13222 LAPACKSupport::Property::hermite_symmetric);
13226 case HMatrixSupport::Property::lower_triangular: {
13228 LAPACKSupport::Property::lower_triangular);
13233 Assert(
false, ExcInvalidHMatrixProperty(Z.
property));
13242 Assert(
false, ExcInvalidHMatrixType(Z.
type));
13255 const unsigned int local_fixed_rank =
13256 std::min(fixed_rank * 2, std::min(Z.
m, Z.
n));
13260 typename numbers::NumberTraits<
13261 Number>::real_type>::child_num>
13262 block_types_for_submatrices_of_local_Z;
13263 HMatrixSupport::infer_submatrix_block_types_from_parent_hmat(
13264 block_type_for_local_Z, block_types_for_submatrices_of_local_Z);
13271 block_types_for_submatrices_of_local_Z[0],
13273 is_result_matrix_Z_store_tril_only);
13279 block_types_for_submatrices_of_local_Z[0],
13281 is_result_matrix_Z_store_tril_only);
13283 if ((!is_result_matrix_Z_store_tril_only) ||
13284 (is_result_matrix_Z_store_tril_only &&
13285 Z.
property != HMatrixSupport::Property::symmetric &&
13286 Z.
property != HMatrixSupport::Property::hermite_symmetric &&
13287 Z.
property != HMatrixSupport::Property::lower_triangular))
13308 block_types_for_submatrices_of_local_Z[1],
13310 is_result_matrix_Z_store_tril_only);
13316 block_types_for_submatrices_of_local_Z[1],
13318 is_result_matrix_Z_store_tril_only);
13326 block_types_for_submatrices_of_local_Z[2],
13328 is_result_matrix_Z_store_tril_only);
13334 block_types_for_submatrices_of_local_Z[2],
13336 is_result_matrix_Z_store_tril_only);
13343 block_types_for_submatrices_of_local_Z[3],
13345 is_result_matrix_Z_store_tril_only);
13351 block_types_for_submatrices_of_local_Z[3],
13353 is_result_matrix_Z_store_tril_only);
13359 if (M0.
bc_node->get_data_reference().get_is_near_field())
13367 if ((!is_result_matrix_store_tril_only) ||
13368 (is_result_matrix_store_tril_only &&
13369 M.
block_type != HMatrixSupport::BlockType::upper_triangular_block &&
13370 Z.
block_type != HMatrixSupport::BlockType::upper_triangular_block))
13390 Assert(M.
rkmatrix, ExcInternalError());
13392 if ((!is_result_matrix_store_tril_only) ||
13393 (is_result_matrix_store_tril_only &&
13394 M.
block_type != HMatrixSupport::BlockType::upper_triangular_block &&
13395 Z.
block_type != HMatrixSupport::BlockType::upper_triangular_block))
13408template <
int spacedim,
typename Number>
13413 const Number alpha,
13417 const unsigned int fixed_rank,
13418 const bool is_result_matrix_store_tril_only =
false)
13424 Assert(M0.
bc_node->is_leaf(), ExcMessage(
"M0 should be a leaf node!"));
13426 if (is_result_matrix_store_tril_only)
13428 Assert(M0.
get_property() == HMatrixSupport::Property::symmetric ||
13430 HMatrixSupport::Property::hermite_symmetric ||
13431 M0.
get_property() == HMatrixSupport::Property::lower_triangular,
13433 Assert(M0.
get_block_type() == HMatrixSupport::BlockType::diagonal_block,
13435 Assert(M.
get_property() == HMatrixSupport::Property::symmetric ||
13437 HMatrixSupport::Property::hermite_symmetric ||
13438 M.
get_property() == HMatrixSupport::Property::lower_triangular,
13440 Assert(M.
get_block_type() == HMatrixSupport::BlockType::diagonal_block,
13449 typename numbers::NumberTraits<Number>::real_type>::node_pointer_type,
13452 typename numbers::NumberTraits<Number>::real_type>::child_num>
13453 empty_child_pointers{{
nullptr,
nullptr,
nullptr,
nullptr}};
13461 typename numbers::NumberTraits<Number>::real_type>::
13462 node_value_type current_product_bc_node(
13463 BlockCluster<spacedim,
typename numbers::NumberTraits<Number>::real_type>(
13464 M1.
bc_node->get_data_reference().get_tau_node(),
13465 M2.
bc_node->get_data_reference().get_sigma_node()),
13467 empty_child_pointers,
13476 if (M0.
bc_node->get_data_reference().get_is_near_field())
13480 current_product_bc_node.get_data_reference().set_is_near_field(
true);
13486 current_product_bc_node.get_data_reference().set_is_near_field(
false);
13497 bool is_result_matrix_Z_store_tril_only =
false;
13499 if (is_result_matrix_store_tril_only &&
13507 is_result_matrix_Z_store_tril_only =
true;
13514 Assert(block_type_for_local_Z ==
13515 HMatrixSupport::BlockType::diagonal_block,
13516 ExcInvalidHMatrixBlockType(block_type_for_local_Z));
13528 block_type_for_local_Z);
13566 Assert(
false, ExcInternalError());
13584 Assert(
false, ExcInvalidHMatrixType(result_matrix_type));
13601 Assert(
false, ExcInvalidHMatrixType(result_matrix_type));
13611 if (is_result_matrix_Z_store_tril_only)
13615 case HMatrixSupport::Property::symmetric: {
13617 LAPACKSupport::Property::symmetric);
13621 case HMatrixSupport::Property::hermite_symmetric: {
13623 LAPACKSupport::Property::hermite_symmetric);
13627 case HMatrixSupport::Property::lower_triangular: {
13629 LAPACKSupport::Property::lower_triangular);
13634 Assert(
false, ExcInvalidHMatrixProperty(Z.
property));
13643 Assert(
false, ExcInvalidHMatrixType(Z.
type));
13656 const unsigned int local_fixed_rank =
13657 std::min(fixed_rank * 2, std::min(Z.
m, Z.
n));
13661 typename numbers::NumberTraits<
13662 Number>::real_type>::child_num>
13663 block_types_for_submatrices_of_local_Z;
13664 HMatrixSupport::infer_submatrix_block_types_from_parent_hmat(
13665 block_type_for_local_Z, block_types_for_submatrices_of_local_Z);
13673 block_types_for_submatrices_of_local_Z[0],
13675 is_result_matrix_Z_store_tril_only);
13682 block_types_for_submatrices_of_local_Z[0],
13684 is_result_matrix_Z_store_tril_only);
13686 if ((!is_result_matrix_Z_store_tril_only) ||
13687 (is_result_matrix_Z_store_tril_only &&
13688 Z.
property != HMatrixSupport::Property::symmetric &&
13689 Z.
property != HMatrixSupport::Property::hermite_symmetric &&
13690 Z.
property != HMatrixSupport::Property::lower_triangular))
13712 block_types_for_submatrices_of_local_Z[1],
13714 is_result_matrix_Z_store_tril_only);
13721 block_types_for_submatrices_of_local_Z[1],
13723 is_result_matrix_Z_store_tril_only);
13732 block_types_for_submatrices_of_local_Z[2],
13734 is_result_matrix_Z_store_tril_only);
13741 block_types_for_submatrices_of_local_Z[2],
13743 is_result_matrix_Z_store_tril_only);
13751 block_types_for_submatrices_of_local_Z[3],
13753 is_result_matrix_Z_store_tril_only);
13760 block_types_for_submatrices_of_local_Z[3],
13762 is_result_matrix_Z_store_tril_only);
13768 if (M0.
bc_node->get_data_reference().get_is_near_field())
13776 if ((!is_result_matrix_store_tril_only) ||
13777 (is_result_matrix_store_tril_only &&
13778 M.
block_type != HMatrixSupport::BlockType::upper_triangular_block &&
13779 Z.
block_type != HMatrixSupport::BlockType::upper_triangular_block))
13786 std::unique_lock<std::mutex> ul(M0.
update_lock, std::defer_lock);
13810 Assert(M.
rkmatrix, ExcInternalError());
13812 if ((!is_result_matrix_store_tril_only) ||
13813 (is_result_matrix_store_tril_only &&
13814 M.
block_type != HMatrixSupport::BlockType::upper_triangular_block &&
13815 Z.
block_type != HMatrixSupport::BlockType::upper_triangular_block))
13822 std::unique_lock<std::mutex> ul(M0.
update_lock, std::defer_lock);
13827#if ARENA_OR_ISOLATE_IN_LU_AND_CHOL == 3
13836#if ARENA_OR_ISOLATE_IN_LU_AND_CHOL == 1
13838 ta.execute([&M, &Z, fixed_rank] {
13848#if ARENA_OR_ISOLATE_IN_LU_AND_CHOL == 2
13853 tbb::this_task_arena::isolate([&M, &Z, fixed_rank] {
13908template <
int spacedim,
typename Number>
13916 const unsigned int fixed_rank,
13917 const bool is_result_matrix_store_tril_only =
false)
13923 Assert(M0.
bc_node->is_leaf(), ExcMessage(
"M0 should be a leaf node!"));
13925 if (is_result_matrix_store_tril_only)
13927 Assert(M0.
get_property() == HMatrixSupport::Property::symmetric ||
13929 HMatrixSupport::Property::hermite_symmetric ||
13930 M0.
get_property() == HMatrixSupport::Property::lower_triangular,
13932 Assert(M0.
get_block_type() == HMatrixSupport::BlockType::diagonal_block,
13934 Assert(M.
get_property() == HMatrixSupport::Property::symmetric ||
13936 HMatrixSupport::Property::hermite_symmetric ||
13937 M.
get_property() == HMatrixSupport::Property::lower_triangular,
13939 Assert(M.
get_block_type() == HMatrixSupport::BlockType::diagonal_block,
13948 typename numbers::NumberTraits<Number>::real_type>::node_pointer_type,
13951 typename numbers::NumberTraits<Number>::real_type>::child_num>
13952 empty_child_pointers{{
nullptr,
nullptr,
nullptr,
nullptr}};
13964 typename numbers::NumberTraits<Number>::real_type>::
13965 node_value_type current_product_bc_node(
13966 BlockCluster<spacedim,
typename numbers::NumberTraits<Number>::real_type>(
13967 M1.
bc_node->get_data_reference().get_tau_node(),
13968 M2.
bc_node->get_data_reference().get_tau_node()),
13970 empty_child_pointers,
13979 if (M0.
bc_node->get_data_reference().get_is_near_field())
13983 current_product_bc_node.get_data_reference().set_is_near_field(
true);
13989 current_product_bc_node.get_data_reference().set_is_near_field(
false);
14001 bool is_result_matrix_Z_store_tril_only =
false;
14003 if (is_result_matrix_store_tril_only &&
14011 is_result_matrix_Z_store_tril_only =
true;
14018 Assert(block_type_for_local_Z ==
14019 HMatrixSupport::BlockType::diagonal_block,
14020 ExcInvalidHMatrixBlockType(block_type_for_local_Z));
14031 block_type_for_local_Z);
14069 Assert(
false, ExcInternalError());
14087 Assert(
false, ExcInvalidHMatrixType(result_matrix_type));
14104 Assert(
false, ExcInvalidHMatrixType(result_matrix_type));
14114 if (is_result_matrix_Z_store_tril_only)
14118 case HMatrixSupport::Property::symmetric: {
14120 LAPACKSupport::Property::symmetric);
14124 case HMatrixSupport::Property::hermite_symmetric: {
14126 LAPACKSupport::Property::hermite_symmetric);
14130 case HMatrixSupport::Property::lower_triangular: {
14132 LAPACKSupport::Property::lower_triangular);
14137 Assert(
false, ExcInvalidHMatrixProperty(Z.
property));
14146 Assert(
false, ExcInvalidHMatrixType(Z.
type));
14159 const unsigned int local_fixed_rank =
14160 std::min(fixed_rank * 2, std::min(Z.
m, Z.
n));
14164 typename numbers::NumberTraits<
14165 Number>::real_type>::child_num>
14166 block_types_for_submatrices_of_local_Z;
14167 HMatrixSupport::infer_submatrix_block_types_from_parent_hmat(
14168 block_type_for_local_Z, block_types_for_submatrices_of_local_Z);
14174 block_types_for_submatrices_of_local_Z[0],
14176 is_result_matrix_Z_store_tril_only);
14181 block_types_for_submatrices_of_local_Z[0],
14183 is_result_matrix_Z_store_tril_only);
14185 if ((!is_result_matrix_Z_store_tril_only) ||
14186 (is_result_matrix_Z_store_tril_only &&
14187 Z.
property != HMatrixSupport::Property::symmetric &&
14188 Z.
property != HMatrixSupport::Property::hermite_symmetric &&
14189 Z.
property != HMatrixSupport::Property::lower_triangular))
14205 block_types_for_submatrices_of_local_Z[1],
14207 is_result_matrix_Z_store_tril_only);
14212 block_types_for_submatrices_of_local_Z[1],
14214 is_result_matrix_Z_store_tril_only);
14221 block_types_for_submatrices_of_local_Z[2],
14223 is_result_matrix_Z_store_tril_only);
14228 block_types_for_submatrices_of_local_Z[2],
14230 is_result_matrix_Z_store_tril_only);
14236 block_types_for_submatrices_of_local_Z[3],
14238 is_result_matrix_Z_store_tril_only);
14243 block_types_for_submatrices_of_local_Z[3],
14245 is_result_matrix_Z_store_tril_only);
14251 if (M0.
bc_node->get_data_reference().get_is_near_field())
14259 if ((!is_result_matrix_store_tril_only) ||
14260 (is_result_matrix_store_tril_only &&
14261 M.
block_type != HMatrixSupport::BlockType::upper_triangular_block &&
14262 Z.
block_type != HMatrixSupport::BlockType::upper_triangular_block))
14282 Assert(M.
rkmatrix, ExcInternalError());
14284 if ((!is_result_matrix_store_tril_only) ||
14285 (is_result_matrix_store_tril_only &&
14286 M.
block_type != HMatrixSupport::BlockType::upper_triangular_block &&
14287 Z.
block_type != HMatrixSupport::BlockType::upper_triangular_block))
14332template <
int spacedim,
typename Number>
14337 const Number alpha,
14341 const unsigned int fixed_rank,
14342 const bool is_result_matrix_store_tril_only =
false)
14348 Assert(M0.
bc_node->is_leaf(), ExcMessage(
"M0 should be a leaf node!"));
14350 if (is_result_matrix_store_tril_only)
14352 Assert(M0.
get_property() == HMatrixSupport::Property::symmetric ||
14354 HMatrixSupport::Property::hermite_symmetric ||
14355 M0.
get_property() == HMatrixSupport::Property::lower_triangular,
14357 Assert(M0.
get_block_type() == HMatrixSupport::BlockType::diagonal_block,
14359 Assert(M.
get_property() == HMatrixSupport::Property::symmetric ||
14361 HMatrixSupport::Property::hermite_symmetric ||
14362 M.
get_property() == HMatrixSupport::Property::lower_triangular,
14364 Assert(M.
get_block_type() == HMatrixSupport::BlockType::diagonal_block,
14373 typename numbers::NumberTraits<Number>::real_type>::node_pointer_type,
14376 typename numbers::NumberTraits<Number>::real_type>::child_num>
14377 empty_child_pointers{{
nullptr,
nullptr,
nullptr,
nullptr}};
14389 typename numbers::NumberTraits<Number>::real_type>::
14390 node_value_type current_product_bc_node(
14391 BlockCluster<spacedim,
typename numbers::NumberTraits<Number>::real_type>(
14392 M1.
bc_node->get_data_reference().get_tau_node(),
14393 M2.
bc_node->get_data_reference().get_tau_node()),
14395 empty_child_pointers,
14404 if (M0.
bc_node->get_data_reference().get_is_near_field())
14408 current_product_bc_node.get_data_reference().set_is_near_field(
true);
14414 current_product_bc_node.get_data_reference().set_is_near_field(
false);
14425 bool is_result_matrix_Z_store_tril_only =
false;
14427 if (is_result_matrix_store_tril_only &&
14435 is_result_matrix_Z_store_tril_only =
true;
14442 Assert(block_type_for_local_Z ==
14443 HMatrixSupport::BlockType::diagonal_block,
14444 ExcInvalidHMatrixBlockType(block_type_for_local_Z));
14455 block_type_for_local_Z);
14494 Assert(
false, ExcInternalError());
14512 Assert(
false, ExcInvalidHMatrixType(result_matrix_type));
14529 Assert(
false, ExcInvalidHMatrixType(result_matrix_type));
14539 if (is_result_matrix_Z_store_tril_only)
14543 case HMatrixSupport::Property::symmetric: {
14545 LAPACKSupport::Property::symmetric);
14549 case HMatrixSupport::Property::hermite_symmetric: {
14551 LAPACKSupport::Property::hermite_symmetric);
14555 case HMatrixSupport::Property::lower_triangular: {
14557 LAPACKSupport::Property::lower_triangular);
14562 Assert(
false, ExcInvalidHMatrixProperty(Z.
property));
14571 Assert(
false, ExcInvalidHMatrixType(Z.
type));
14584 const unsigned int local_fixed_rank =
14585 std::min(fixed_rank * 2, std::min(Z.
m, Z.
n));
14589 typename numbers::NumberTraits<
14590 Number>::real_type>::child_num>
14591 block_types_for_submatrices_of_local_Z;
14592 HMatrixSupport::infer_submatrix_block_types_from_parent_hmat(
14593 block_type_for_local_Z, block_types_for_submatrices_of_local_Z);
14600 block_types_for_submatrices_of_local_Z[0],
14602 is_result_matrix_Z_store_tril_only);
14608 block_types_for_submatrices_of_local_Z[0],
14610 is_result_matrix_Z_store_tril_only);
14612 if ((!is_result_matrix_Z_store_tril_only) ||
14613 (is_result_matrix_Z_store_tril_only &&
14614 Z.
property != HMatrixSupport::Property::symmetric &&
14615 Z.
property != HMatrixSupport::Property::hermite_symmetric &&
14616 Z.
property != HMatrixSupport::Property::lower_triangular))
14633 block_types_for_submatrices_of_local_Z[1],
14635 is_result_matrix_Z_store_tril_only);
14641 block_types_for_submatrices_of_local_Z[1],
14643 is_result_matrix_Z_store_tril_only);
14651 block_types_for_submatrices_of_local_Z[2],
14653 is_result_matrix_Z_store_tril_only);
14659 block_types_for_submatrices_of_local_Z[2],
14661 is_result_matrix_Z_store_tril_only);
14668 block_types_for_submatrices_of_local_Z[3],
14670 is_result_matrix_Z_store_tril_only);
14676 block_types_for_submatrices_of_local_Z[3],
14678 is_result_matrix_Z_store_tril_only);
14684 if (M0.
bc_node->get_data_reference().get_is_near_field())
14692 if ((!is_result_matrix_store_tril_only) ||
14693 (is_result_matrix_store_tril_only &&
14694 M.
block_type != HMatrixSupport::BlockType::upper_triangular_block &&
14695 Z.
block_type != HMatrixSupport::BlockType::upper_triangular_block))
14715 Assert(M.
rkmatrix, ExcInternalError());
14717 if ((!is_result_matrix_store_tril_only) ||
14718 (is_result_matrix_store_tril_only &&
14719 M.
block_type != HMatrixSupport::BlockType::upper_triangular_block &&
14720 Z.
block_type != HMatrixSupport::BlockType::upper_triangular_block))
14733template <
int spacedim,
typename Number>
14738 const Number alpha,
14742 const unsigned int fixed_rank,
14743 const bool is_result_matrix_store_tril_only =
false)
14749 Assert(M0.
bc_node->is_leaf(), ExcMessage(
"M0 should be a leaf node!"));
14751 if (is_result_matrix_store_tril_only)
14753 Assert(M0.
get_property() == HMatrixSupport::Property::symmetric ||
14755 HMatrixSupport::Property::hermite_symmetric ||
14756 M0.
get_property() == HMatrixSupport::Property::lower_triangular,
14758 Assert(M0.
get_block_type() == HMatrixSupport::BlockType::diagonal_block,
14760 Assert(M.
get_property() == HMatrixSupport::Property::symmetric ||
14762 HMatrixSupport::Property::hermite_symmetric ||
14763 M.
get_property() == HMatrixSupport::Property::lower_triangular,
14765 Assert(M.
get_block_type() == HMatrixSupport::BlockType::diagonal_block,
14774 typename numbers::NumberTraits<Number>::real_type>::node_pointer_type,
14777 typename numbers::NumberTraits<Number>::real_type>::child_num>
14778 empty_child_pointers{{
nullptr,
nullptr,
nullptr,
nullptr}};
14790 typename numbers::NumberTraits<Number>::real_type>::
14791 node_value_type current_product_bc_node(
14792 BlockCluster<spacedim,
typename numbers::NumberTraits<Number>::real_type>(
14793 M1.
bc_node->get_data_reference().get_tau_node(),
14794 M2.
bc_node->get_data_reference().get_tau_node()),
14796 empty_child_pointers,
14805 if (M0.
bc_node->get_data_reference().get_is_near_field())
14809 current_product_bc_node.get_data_reference().set_is_near_field(
true);
14815 current_product_bc_node.get_data_reference().set_is_near_field(
false);
14826 bool is_result_matrix_Z_store_tril_only =
false;
14828 if (is_result_matrix_store_tril_only &&
14836 is_result_matrix_Z_store_tril_only =
true;
14843 Assert(block_type_for_local_Z ==
14844 HMatrixSupport::BlockType::diagonal_block,
14845 ExcInvalidHMatrixBlockType(block_type_for_local_Z));
14856 block_type_for_local_Z);
14895 Assert(
false, ExcInternalError());
14913 Assert(
false, ExcInvalidHMatrixType(result_matrix_type));
14930 Assert(
false, ExcInvalidHMatrixType(result_matrix_type));
14940 if (is_result_matrix_Z_store_tril_only)
14944 case HMatrixSupport::Property::symmetric: {
14946 LAPACKSupport::Property::symmetric);
14950 case HMatrixSupport::Property::hermite_symmetric: {
14952 LAPACKSupport::Property::hermite_symmetric);
14956 case HMatrixSupport::Property::lower_triangular: {
14958 LAPACKSupport::Property::lower_triangular);
14963 Assert(
false, ExcInvalidHMatrixProperty(Z.
property));
14972 Assert(
false, ExcInvalidHMatrixType(Z.
type));
14985 const unsigned int local_fixed_rank =
14986 std::min(fixed_rank * 2, std::min(Z.
m, Z.
n));
14990 typename numbers::NumberTraits<
14991 Number>::real_type>::child_num>
14992 block_types_for_submatrices_of_local_Z;
14993 HMatrixSupport::infer_submatrix_block_types_from_parent_hmat(
14994 block_type_for_local_Z, block_types_for_submatrices_of_local_Z);
15002 block_types_for_submatrices_of_local_Z[0],
15004 is_result_matrix_Z_store_tril_only);
15011 block_types_for_submatrices_of_local_Z[0],
15013 is_result_matrix_Z_store_tril_only);
15015 if ((!is_result_matrix_Z_store_tril_only) ||
15016 (is_result_matrix_Z_store_tril_only &&
15017 Z.
property != HMatrixSupport::Property::symmetric &&
15018 Z.
property != HMatrixSupport::Property::hermite_symmetric &&
15019 Z.
property != HMatrixSupport::Property::lower_triangular))
15037 block_types_for_submatrices_of_local_Z[1],
15039 is_result_matrix_Z_store_tril_only);
15046 block_types_for_submatrices_of_local_Z[1],
15048 is_result_matrix_Z_store_tril_only);
15057 block_types_for_submatrices_of_local_Z[2],
15059 is_result_matrix_Z_store_tril_only);
15066 block_types_for_submatrices_of_local_Z[2],
15068 is_result_matrix_Z_store_tril_only);
15076 block_types_for_submatrices_of_local_Z[3],
15078 is_result_matrix_Z_store_tril_only);
15085 block_types_for_submatrices_of_local_Z[3],
15087 is_result_matrix_Z_store_tril_only);
15093 if (M0.
bc_node->get_data_reference().get_is_near_field())
15101 if ((!is_result_matrix_store_tril_only) ||
15102 (is_result_matrix_store_tril_only &&
15103 M.
block_type != HMatrixSupport::BlockType::upper_triangular_block &&
15104 Z.
block_type != HMatrixSupport::BlockType::upper_triangular_block))
15111 std::unique_lock<std::mutex> ul(M0.
update_lock, std::defer_lock);
15135 Assert(M.
rkmatrix, ExcInternalError());
15137 if ((!is_result_matrix_store_tril_only) ||
15138 (is_result_matrix_store_tril_only &&
15139 M.
block_type != HMatrixSupport::BlockType::upper_triangular_block &&
15140 Z.
block_type != HMatrixSupport::BlockType::upper_triangular_block))
15147 std::unique_lock<std::mutex> ul(M0.
update_lock, std::defer_lock);
15152#if ARENA_OR_ISOLATE_IN_LU_AND_CHOL == 3
15161#if ARENA_OR_ISOLATE_IN_LU_AND_CHOL == 1
15163 ta.execute([&M, &Z, fixed_rank] {
15173#if ARENA_OR_ISOLATE_IN_LU_AND_CHOL == 2
15178 tbb::this_task_arena::isolate([&M, &Z, fixed_rank] {
15217template <
int spacedim,
typename Number>
15225 const unsigned int fixed_rank,
15226 const bool is_result_matrix_store_tril_only =
false)
15232 Assert(M0.
bc_node->is_leaf(), ExcMessage(
"M0 should be a leaf node!"));
15234 if (is_result_matrix_store_tril_only)
15236 Assert(M0.
get_property() == HMatrixSupport::Property::symmetric ||
15238 HMatrixSupport::Property::hermite_symmetric ||
15239 M0.
get_property() == HMatrixSupport::Property::lower_triangular,
15241 Assert(M0.
get_block_type() == HMatrixSupport::BlockType::diagonal_block,
15243 Assert(M.
get_property() == HMatrixSupport::Property::symmetric ||
15245 HMatrixSupport::Property::hermite_symmetric ||
15246 M.
get_property() == HMatrixSupport::Property::lower_triangular,
15248 Assert(M.
get_block_type() == HMatrixSupport::BlockType::diagonal_block,
15257 typename numbers::NumberTraits<Number>::real_type>::node_pointer_type,
15260 typename numbers::NumberTraits<Number>::real_type>::child_num>
15261 empty_child_pointers{{
nullptr,
nullptr,
nullptr,
nullptr}};
15273 typename numbers::NumberTraits<Number>::real_type>::
15274 node_value_type current_product_bc_node(
15275 BlockCluster<spacedim,
typename numbers::NumberTraits<Number>::real_type>(
15276 M1.
bc_node->get_data_reference().get_sigma_node(),
15277 M2.
bc_node->get_data_reference().get_sigma_node()),
15279 empty_child_pointers,
15288 if (M0.
bc_node->get_data_reference().get_is_near_field())
15292 current_product_bc_node.get_data_reference().set_is_near_field(
true);
15298 current_product_bc_node.get_data_reference().set_is_near_field(
false);
15309 bool is_result_matrix_Z_store_tril_only =
false;
15311 if (is_result_matrix_store_tril_only &&
15319 is_result_matrix_Z_store_tril_only =
true;
15326 Assert(block_type_for_local_Z ==
15327 HMatrixSupport::BlockType::diagonal_block,
15328 ExcInvalidHMatrixBlockType(block_type_for_local_Z));
15339 block_type_for_local_Z);
15377 Assert(
false, ExcInternalError());
15395 Assert(
false, ExcInvalidHMatrixType(result_matrix_type));
15412 Assert(
false, ExcInvalidHMatrixType(result_matrix_type));
15422 if (is_result_matrix_Z_store_tril_only)
15426 case HMatrixSupport::Property::symmetric: {
15428 LAPACKSupport::Property::symmetric);
15432 case HMatrixSupport::Property::hermite_symmetric: {
15434 LAPACKSupport::Property::hermite_symmetric);
15438 case HMatrixSupport::Property::lower_triangular: {
15440 LAPACKSupport::Property::lower_triangular);
15445 Assert(
false, ExcInvalidHMatrixProperty(Z.
property));
15454 Assert(
false, ExcInvalidHMatrixType(Z.
type));
15467 const unsigned int local_fixed_rank =
15468 std::min(fixed_rank * 2, std::min(Z.
m, Z.
n));
15472 typename numbers::NumberTraits<
15473 Number>::real_type>::child_num>
15474 block_types_for_submatrices_of_local_Z;
15475 HMatrixSupport::infer_submatrix_block_types_from_parent_hmat(
15476 block_type_for_local_Z, block_types_for_submatrices_of_local_Z);
15482 block_types_for_submatrices_of_local_Z[0],
15484 is_result_matrix_Z_store_tril_only);
15489 block_types_for_submatrices_of_local_Z[0],
15491 is_result_matrix_Z_store_tril_only);
15493 if ((!is_result_matrix_Z_store_tril_only) ||
15494 (is_result_matrix_Z_store_tril_only &&
15495 Z.
property != HMatrixSupport::Property::symmetric &&
15496 Z.
property != HMatrixSupport::Property::hermite_symmetric &&
15497 Z.
property != HMatrixSupport::Property::lower_triangular))
15513 block_types_for_submatrices_of_local_Z[1],
15515 is_result_matrix_Z_store_tril_only);
15520 block_types_for_submatrices_of_local_Z[1],
15522 is_result_matrix_Z_store_tril_only);
15529 block_types_for_submatrices_of_local_Z[2],
15531 is_result_matrix_Z_store_tril_only);
15536 block_types_for_submatrices_of_local_Z[2],
15538 is_result_matrix_Z_store_tril_only);
15544 block_types_for_submatrices_of_local_Z[3],
15546 is_result_matrix_Z_store_tril_only);
15551 block_types_for_submatrices_of_local_Z[3],
15553 is_result_matrix_Z_store_tril_only);
15559 if (M0.
bc_node->get_data_reference().get_is_near_field())
15567 if ((!is_result_matrix_store_tril_only) ||
15568 (is_result_matrix_store_tril_only &&
15569 M.
block_type != HMatrixSupport::BlockType::upper_triangular_block &&
15570 Z.
block_type != HMatrixSupport::BlockType::upper_triangular_block))
15590 Assert(M.
rkmatrix, ExcInternalError());
15592 if ((!is_result_matrix_store_tril_only) ||
15593 (is_result_matrix_store_tril_only &&
15594 M.
block_type != HMatrixSupport::BlockType::upper_triangular_block &&
15595 Z.
block_type != HMatrixSupport::BlockType::upper_triangular_block))
15624template <
int spacedim,
typename Number>
15629 const Number alpha,
15633 const unsigned int fixed_rank,
15634 const bool is_result_matrix_store_tril_only =
false)
15640 Assert(M0.
bc_node->is_leaf(), ExcMessage(
"M0 should be a leaf node!"));
15642 if (is_result_matrix_store_tril_only)
15644 Assert(M0.
get_property() == HMatrixSupport::Property::symmetric ||
15646 HMatrixSupport::Property::hermite_symmetric ||
15647 M0.
get_property() == HMatrixSupport::Property::lower_triangular,
15649 Assert(M0.
get_block_type() == HMatrixSupport::BlockType::diagonal_block,
15651 Assert(M.
get_property() == HMatrixSupport::Property::symmetric ||
15653 HMatrixSupport::Property::hermite_symmetric ||
15654 M.
get_property() == HMatrixSupport::Property::lower_triangular,
15656 Assert(M.
get_block_type() == HMatrixSupport::BlockType::diagonal_block,
15665 typename numbers::NumberTraits<Number>::real_type>::node_pointer_type,
15668 typename numbers::NumberTraits<Number>::real_type>::child_num>
15669 empty_child_pointers{{
nullptr,
nullptr,
nullptr,
nullptr}};
15681 typename numbers::NumberTraits<Number>::real_type>::
15682 node_value_type current_product_bc_node(
15683 BlockCluster<spacedim,
typename numbers::NumberTraits<Number>::real_type>(
15684 M1.
bc_node->get_data_reference().get_sigma_node(),
15685 M2.
bc_node->get_data_reference().get_sigma_node()),
15687 empty_child_pointers,
15696 if (M0.
bc_node->get_data_reference().get_is_near_field())
15700 current_product_bc_node.get_data_reference().set_is_near_field(
true);
15706 current_product_bc_node.get_data_reference().set_is_near_field(
false);
15717 bool is_result_matrix_Z_store_tril_only =
false;
15719 if (is_result_matrix_store_tril_only &&
15727 is_result_matrix_Z_store_tril_only =
true;
15734 Assert(block_type_for_local_Z ==
15735 HMatrixSupport::BlockType::diagonal_block,
15736 ExcInvalidHMatrixBlockType(block_type_for_local_Z));
15747 block_type_for_local_Z);
15785 Assert(
false, ExcInternalError());
15803 Assert(
false, ExcInvalidHMatrixType(result_matrix_type));
15820 Assert(
false, ExcInvalidHMatrixType(result_matrix_type));
15830 if (is_result_matrix_Z_store_tril_only)
15834 case HMatrixSupport::Property::symmetric: {
15836 LAPACKSupport::Property::symmetric);
15840 case HMatrixSupport::Property::hermite_symmetric: {
15842 LAPACKSupport::Property::hermite_symmetric);
15846 case HMatrixSupport::Property::lower_triangular: {
15848 LAPACKSupport::Property::lower_triangular);
15853 Assert(
false, ExcInvalidHMatrixProperty(Z.
property));
15862 Assert(
false, ExcInvalidHMatrixType(Z.
type));
15875 const unsigned int local_fixed_rank =
15876 std::min(fixed_rank * 2, std::min(Z.
m, Z.
n));
15880 typename numbers::NumberTraits<
15881 Number>::real_type>::child_num>
15882 block_types_for_submatrices_of_local_Z;
15883 HMatrixSupport::infer_submatrix_block_types_from_parent_hmat(
15884 block_type_for_local_Z, block_types_for_submatrices_of_local_Z);
15891 block_types_for_submatrices_of_local_Z[0],
15893 is_result_matrix_Z_store_tril_only);
15899 block_types_for_submatrices_of_local_Z[0],
15901 is_result_matrix_Z_store_tril_only);
15903 if ((!is_result_matrix_Z_store_tril_only) ||
15904 (is_result_matrix_Z_store_tril_only &&
15905 Z.
property != HMatrixSupport::Property::symmetric &&
15906 Z.
property != HMatrixSupport::Property::hermite_symmetric &&
15907 Z.
property != HMatrixSupport::Property::lower_triangular))
15924 block_types_for_submatrices_of_local_Z[1],
15926 is_result_matrix_Z_store_tril_only);
15932 block_types_for_submatrices_of_local_Z[1],
15934 is_result_matrix_Z_store_tril_only);
15942 block_types_for_submatrices_of_local_Z[2],
15944 is_result_matrix_Z_store_tril_only);
15950 block_types_for_submatrices_of_local_Z[2],
15952 is_result_matrix_Z_store_tril_only);
15959 block_types_for_submatrices_of_local_Z[3],
15961 is_result_matrix_Z_store_tril_only);
15967 block_types_for_submatrices_of_local_Z[3],
15969 is_result_matrix_Z_store_tril_only);
15975 if (M0.
bc_node->get_data_reference().get_is_near_field())
15983 if ((!is_result_matrix_store_tril_only) ||
15984 (is_result_matrix_store_tril_only &&
15985 M.
block_type != HMatrixSupport::BlockType::upper_triangular_block &&
15986 Z.
block_type != HMatrixSupport::BlockType::upper_triangular_block))
16006 Assert(M.
rkmatrix, ExcInternalError());
16008 if ((!is_result_matrix_store_tril_only) ||
16009 (is_result_matrix_store_tril_only &&
16010 M.
block_type != HMatrixSupport::BlockType::upper_triangular_block &&
16011 Z.
block_type != HMatrixSupport::BlockType::upper_triangular_block))
16037template <
int spacedim,
typename Number>
16042 const unsigned int fixed_rank,
16043 const bool is_result_matrix_store_tril_only =
false)
16056 is_result_matrix_store_tril_only);
16061 is_result_matrix_store_tril_only);
16068 if ((!is_result_matrix_store_tril_only) ||
16069 (is_result_matrix_store_tril_only &&
16070 M.
property != HMatrixSupport::Property::symmetric &&
16071 M.
property != HMatrixSupport::Property::hermite_symmetric &&
16072 M.
property != HMatrixSupport::Property::lower_triangular))
16110 is_result_matrix_store_tril_only);
16115 is_result_matrix_store_tril_only);
16117 else if (!(M.
bc_node->is_leaf()))
16152 Assert(
false, ExcInternalError());
16169 M.
add(Z, fixed_rank, is_result_matrix_store_tril_only);
16186 is_result_matrix_store_tril_only);
16208template <
int spacedim,
typename Number>
16211 const Number alpha,
16214 const unsigned int fixed_rank,
16215 const bool is_result_matrix_store_tril_only =
false)
16229 is_result_matrix_store_tril_only);
16235 is_result_matrix_store_tril_only);
16241 if ((!is_result_matrix_store_tril_only) ||
16242 (is_result_matrix_store_tril_only &&
16243 M.
property != HMatrixSupport::Property::symmetric &&
16244 M.
property != HMatrixSupport::Property::hermite_symmetric &&
16245 M.
property != HMatrixSupport::Property::lower_triangular))
16288 is_result_matrix_store_tril_only);
16294 is_result_matrix_store_tril_only);
16296 else if (!(M.
bc_node->is_leaf()))
16331 Assert(
false, ExcInternalError());
16348 M.
add(Z, fixed_rank, is_result_matrix_store_tril_only);
16366 is_result_matrix_store_tril_only);
16371template <
int spacedim,
typename Number>
16375 const Number alpha,
16378 const unsigned int fixed_rank,
16379 const bool is_result_matrix_store_tril_only =
false)
16394 is_result_matrix_store_tril_only);
16401 is_result_matrix_store_tril_only);
16407 if ((!is_result_matrix_store_tril_only) ||
16408 (is_result_matrix_store_tril_only &&
16409 M.
property != HMatrixSupport::Property::symmetric &&
16410 M.
property != HMatrixSupport::Property::hermite_symmetric &&
16411 M.
property != HMatrixSupport::Property::lower_triangular))
16455 is_result_matrix_store_tril_only);
16462 is_result_matrix_store_tril_only);
16464 else if (!(M.
bc_node->is_leaf()))
16499 Assert(
false, ExcInternalError());
16518 is_result_matrix_store_tril_only);
16537 is_result_matrix_store_tril_only);
16556template <
int spacedim,
typename Number>
16561 const unsigned int fixed_rank,
16562 const bool is_result_matrix_store_tril_only =
false)
16575 is_result_matrix_store_tril_only);
16580 is_result_matrix_store_tril_only);
16586 if ((!is_result_matrix_store_tril_only) ||
16587 (is_result_matrix_store_tril_only &&
16588 M.
property != HMatrixSupport::Property::symmetric &&
16589 M.
property != HMatrixSupport::Property::hermite_symmetric &&
16590 M.
property != HMatrixSupport::Property::lower_triangular))
16628 is_result_matrix_store_tril_only);
16633 is_result_matrix_store_tril_only);
16635 else if (!(M.
bc_node->is_leaf()))
16669 Assert(
false, ExcInternalError());
16686 M.
add(Z, fixed_rank, is_result_matrix_store_tril_only);
16703 is_result_matrix_store_tril_only);
16723template <
int spacedim,
typename Number>
16726 const Number alpha,
16729 const unsigned int fixed_rank,
16730 const bool is_result_matrix_store_tril_only =
false)
16744 is_result_matrix_store_tril_only);
16750 is_result_matrix_store_tril_only);
16756 if ((!is_result_matrix_store_tril_only) ||
16757 (is_result_matrix_store_tril_only &&
16758 M.
property != HMatrixSupport::Property::symmetric &&
16759 M.
property != HMatrixSupport::Property::hermite_symmetric &&
16760 M.
property != HMatrixSupport::Property::lower_triangular))
16803 is_result_matrix_store_tril_only);
16809 is_result_matrix_store_tril_only);
16811 else if (!(M.
bc_node->is_leaf()))
16845 Assert(
false, ExcInternalError());
16862 M.
add(Z, fixed_rank, is_result_matrix_store_tril_only);
16880 is_result_matrix_store_tril_only);
16885template <
int spacedim,
typename Number>
16889 const Number alpha,
16892 const unsigned int fixed_rank,
16893 const bool is_result_matrix_store_tril_only =
false)
16908 is_result_matrix_store_tril_only);
16915 is_result_matrix_store_tril_only);
16921 if ((!is_result_matrix_store_tril_only) ||
16922 (is_result_matrix_store_tril_only &&
16923 M.
property != HMatrixSupport::Property::symmetric &&
16924 M.
property != HMatrixSupport::Property::hermite_symmetric &&
16925 M.
property != HMatrixSupport::Property::lower_triangular))
16971 is_result_matrix_store_tril_only);
16978 is_result_matrix_store_tril_only);
16980 else if (!(M.
bc_node->is_leaf()))
17014 Assert(
false, ExcInternalError());
17033 is_result_matrix_store_tril_only);
17052 is_result_matrix_store_tril_only);
17071template <
int spacedim,
typename Number>
17076 const unsigned int fixed_rank,
17077 const bool is_result_matrix_store_tril_only =
false)
17090 is_result_matrix_store_tril_only);
17095 is_result_matrix_store_tril_only);
17101 if ((!is_result_matrix_store_tril_only) ||
17102 (is_result_matrix_store_tril_only &&
17103 M.
property != HMatrixSupport::Property::symmetric &&
17104 M.
property != HMatrixSupport::Property::hermite_symmetric &&
17105 M.
property != HMatrixSupport::Property::lower_triangular))
17143 is_result_matrix_store_tril_only);
17148 is_result_matrix_store_tril_only);
17150 else if (!(M.
bc_node->is_leaf()))
17185 Assert(
false, ExcInternalError());
17202 M.
add(Z, fixed_rank, is_result_matrix_store_tril_only);
17219 is_result_matrix_store_tril_only);
17239template <
int spacedim,
typename Number>
17242 const Number alpha,
17245 const unsigned int fixed_rank,
17246 const bool is_result_matrix_store_tril_only =
false)
17260 is_result_matrix_store_tril_only);
17266 is_result_matrix_store_tril_only);
17272 if ((!is_result_matrix_store_tril_only) ||
17273 (is_result_matrix_store_tril_only &&
17274 M.
property != HMatrixSupport::Property::symmetric &&
17275 M.
property != HMatrixSupport::Property::hermite_symmetric &&
17276 M.
property != HMatrixSupport::Property::lower_triangular))
17319 is_result_matrix_store_tril_only);
17325 is_result_matrix_store_tril_only);
17327 else if (!(M.
bc_node->is_leaf()))
17362 Assert(
false, ExcInternalError());
17379 M.
add(Z, fixed_rank, is_result_matrix_store_tril_only);
17397 is_result_matrix_store_tril_only);
17419template <
int spacedim,
typename Number =
double>
17458 hmat_dst.
m = hmat_src.
m;
17459 hmat_dst.
n = hmat_src.
n;
17472template <
int spacedim,
typename Number =
double>
17477 hmat_dst.
type = hmat_src.type;
17478 hmat_dst.
state = hmat_src.state;
17479 hmat_dst.
property = hmat_src.property;
17484 hmat_dst.
parent = hmat_src.parent;
17487 hmat_src.next_same_level_same_row_hmat_node;
17489 hmat_src.next_same_level_same_column_hmat_node;
17491 hmat_src.previous_same_level_same_row_hmat_node;
17493 hmat_src.previous_same_level_same_column_hmat_node;
17494 hmat_dst.
leaf_set = hmat_src.leaf_set;
17497 hmat_dst.
rkmatrix = hmat_src.rkmatrix;
17499 hmat_dst.
bc_node = hmat_src.bc_node;
17502 hmat_dst.
m = hmat_src.m;
17503 hmat_dst.
n = hmat_src.n;
17504 hmat_dst.
Sigma_P = hmat_src.Sigma_P;
17505 hmat_dst.
Sigma_R = hmat_src.Sigma_R;
17506 hmat_dst.
Sigma_F = hmat_src.Sigma_F;
17507 hmat_dst.
Tind = std::move(hmat_src.Tind);
17516template <
int spacedim,
typename Number =
double>
17531 Assert(submatrix, ExcInternalError());
17541 child_hmat->
parent = &hmat_dst;
17546template <
int spacedim,
typename Number =
double>
17548print_h_submatrix_accessor(std::ostream &out,
17549 const std::string &name,
17552 out << name + std::string(
"([") << std::flush;
17554 out <<
"],[" << std::flush;
17560template <
int spacedim,
typename Number =
double>
17562print_h_h_submatrix_mmult_accessor(std::ostream &out,
17563 const std::string &name1,
17565 const std::string &name2,
17568 print_h_submatrix_accessor(out, name1, M1);
17570 print_h_submatrix_accessor(out, name2, M2);
17574template <
int spacedim,
typename Number>
17579 const Vector<Number> &b)
17587template <
int spacedim,
typename Number>
17591 const Vector<Number> &b)
17599template <
int spacedim,
typename Number>
17602 , state(HMatrixSupport::State::matrix)
17603 , property(HMatrixSupport::Property::general)
17604 , block_type(HMatrixSupport::BlockType::undefined_block)
17608 , next_same_level_hmat_node(nullptr)
17609 , next_same_level_same_row_hmat_node(nullptr)
17610 , next_same_level_same_column_hmat_node(nullptr)
17611 , previous_same_level_same_row_hmat_node(nullptr)
17612 , previous_same_level_same_column_hmat_node(nullptr)
17613 , submatrix_index(submatrix_index_invalid)
17615 , near_field_leaf_set(0)
17616 , far_field_leaf_set(0)
17617 , rkmatrix(nullptr)
17618 , fullmatrix(nullptr)
17620 , row_index_range(nullptr)
17621 , col_index_range(nullptr)
17631template <
int spacedim,
typename Number>
17634 const unsigned int fixed_rank_k,
17638 , state(HMatrixSupport::State::matrix)
17639 , property(property)
17640 , block_type(block_type)
17644 , next_same_level_hmat_node(nullptr)
17645 , next_same_level_same_row_hmat_node(nullptr)
17646 , next_same_level_same_column_hmat_node(nullptr)
17647 , previous_same_level_same_row_hmat_node(nullptr)
17648 , previous_same_level_same_column_hmat_node(nullptr)
17649 , submatrix_index(submatrix_index_invalid)
17651 , near_field_leaf_set(0)
17652 , far_field_leaf_set(0)
17653 , rkmatrix(nullptr)
17654 , fullmatrix(nullptr)
17656 , row_index_range(nullptr)
17657 , col_index_range(nullptr)
17665 InitAndCreateHMatrixChildren(
this, bct.
get_root(), fixed_rank_k,
property);
17672template <
int spacedim,
typename Number>
17676 const unsigned int fixed_rank_k,
17680 , state(HMatrixSupport::State::matrix)
17681 , property(property)
17682 , block_type(block_type)
17686 , next_same_level_hmat_node(nullptr)
17687 , next_same_level_same_row_hmat_node(nullptr)
17688 , next_same_level_same_column_hmat_node(nullptr)
17689 , previous_same_level_same_row_hmat_node(nullptr)
17690 , previous_same_level_same_column_hmat_node(nullptr)
17691 , submatrix_index(submatrix_index_invalid)
17693 , near_field_leaf_set(0)
17694 , far_field_leaf_set(0)
17695 , rkmatrix(nullptr)
17696 , fullmatrix(nullptr)
17698 , row_index_range(nullptr)
17699 , col_index_range(nullptr)
17714template <
int spacedim,
typename Number>
17718 const unsigned int fixed_rank_k,
17721 , state(HMatrixSupport::State::matrix)
17722 , property(HMatrixSupport::Property::general)
17723 , block_type(block_type)
17727 , next_same_level_hmat_node(nullptr)
17728 , next_same_level_same_row_hmat_node(nullptr)
17729 , next_same_level_same_column_hmat_node(nullptr)
17730 , previous_same_level_same_row_hmat_node(nullptr)
17731 , previous_same_level_same_column_hmat_node(nullptr)
17732 , submatrix_index(submatrix_index_invalid)
17734 , near_field_leaf_set(0)
17735 , far_field_leaf_set(0)
17736 , rkmatrix(nullptr)
17737 , fullmatrix(nullptr)
17739 , row_index_range(nullptr)
17740 , col_index_range(nullptr)
17753 InitAndCreateHMatrixChildren(
this, bct.
get_root(), fixed_rank_k, M,
property);
17760template <
int spacedim,
typename Number>
17766 , state(HMatrixSupport::State::matrix)
17767 , property(HMatrixSupport::Property::general)
17768 , block_type(block_type)
17772 , next_same_level_hmat_node(nullptr)
17773 , next_same_level_same_row_hmat_node(nullptr)
17774 , next_same_level_same_column_hmat_node(nullptr)
17775 , previous_same_level_same_row_hmat_node(nullptr)
17776 , previous_same_level_same_column_hmat_node(nullptr)
17777 , submatrix_index(submatrix_index_invalid)
17779 , near_field_leaf_set(0)
17780 , far_field_leaf_set(0)
17781 , rkmatrix(nullptr)
17782 , fullmatrix(nullptr)
17784 , row_index_range(nullptr)
17785 , col_index_range(nullptr)
17805template <
int spacedim,
typename Number>
17810 const unsigned int fixed_rank_k,
17814 , state(HMatrixSupport::State::matrix)
17815 , property(property)
17816 , block_type(block_type)
17820 , next_same_level_hmat_node(nullptr)
17821 , next_same_level_same_row_hmat_node(nullptr)
17822 , next_same_level_same_column_hmat_node(nullptr)
17823 , previous_same_level_same_row_hmat_node(nullptr)
17824 , previous_same_level_same_column_hmat_node(nullptr)
17825 , submatrix_index(submatrix_index_invalid)
17827 , near_field_leaf_set(0)
17828 , far_field_leaf_set(0)
17829 , rkmatrix(nullptr)
17830 , fullmatrix(nullptr)
17832 , row_index_range(nullptr)
17833 , col_index_range(nullptr)
17841 InitAndCreateHMatrixChildren(
this,
bc_node, fixed_rank_k, M,
property);
17848template <
int spacedim,
typename Number>
17856 , state(HMatrixSupport::State::matrix)
17857 , property(property)
17858 , block_type(block_type)
17862 , next_same_level_hmat_node(nullptr)
17863 , next_same_level_same_row_hmat_node(nullptr)
17864 , next_same_level_same_column_hmat_node(nullptr)
17865 , previous_same_level_same_row_hmat_node(nullptr)
17866 , previous_same_level_same_column_hmat_node(nullptr)
17867 , submatrix_index(submatrix_index_invalid)
17869 , near_field_leaf_set(0)
17870 , far_field_leaf_set(0)
17871 , rkmatrix(nullptr)
17872 , fullmatrix(nullptr)
17874 , row_index_range(nullptr)
17875 , col_index_range(nullptr)
17890template <
int spacedim,
typename Number>
17898 , state(HMatrixSupport::State::matrix)
17899 , property(property)
17900 , block_type(block_type)
17904 , next_same_level_hmat_node(nullptr)
17905 , next_same_level_same_row_hmat_node(nullptr)
17906 , next_same_level_same_column_hmat_node(nullptr)
17907 , previous_same_level_same_row_hmat_node(nullptr)
17908 , previous_same_level_same_column_hmat_node(nullptr)
17909 , submatrix_index(submatrix_index_invalid)
17911 , near_field_leaf_set(0)
17912 , far_field_leaf_set(0)
17913 , rkmatrix(nullptr)
17914 , fullmatrix(nullptr)
17916 , row_index_range(nullptr)
17917 , col_index_range(nullptr)
17920 , Tind(std::move(H.Tind))
17925 InitAndCreateHMatrixChildren(
this,
bc_node, std::move(H));
17932template <
int spacedim,
typename Number>
17939 , state(HMatrixSupport::State::matrix)
17940 , property(property)
17941 , block_type(block_type)
17945 , next_same_level_hmat_node(nullptr)
17946 , next_same_level_same_row_hmat_node(nullptr)
17947 , next_same_level_same_column_hmat_node(nullptr)
17948 , previous_same_level_same_row_hmat_node(nullptr)
17949 , previous_same_level_same_column_hmat_node(nullptr)
17950 , submatrix_index(submatrix_index_invalid)
17952 , near_field_leaf_set(0)
17953 , far_field_leaf_set(0)
17954 , rkmatrix(nullptr)
17955 , fullmatrix(nullptr)
17957 , row_index_range(nullptr)
17958 , col_index_range(nullptr)
17961 , Tind(std::move(H.Tind))
17966 InitAndCreateHMatrixChildren(
this, bct.
get_root(), std::move(H));
17973template <
int spacedim,
typename Number>
17976 , state(HMatrixSupport::State::matrix)
17977 , property(HMatrixSupport::Property::general)
17978 , block_type(HMatrixSupport::BlockType::undefined_block)
17982 , next_same_level_hmat_node(nullptr)
17983 , next_same_level_same_row_hmat_node(nullptr)
17984 , next_same_level_same_column_hmat_node(nullptr)
17985 , previous_same_level_same_row_hmat_node(nullptr)
17986 , previous_same_level_same_column_hmat_node(nullptr)
17987 , submatrix_index(submatrix_index_invalid)
17989 , near_field_leaf_set(0)
17990 , far_field_leaf_set(0)
17991 , rkmatrix(nullptr)
17992 , fullmatrix(nullptr)
17994 , row_index_range(nullptr)
17995 , col_index_range(nullptr)
18003 copy_hmatrix(*
this, H);
18010template <
int spacedim,
typename Number>
18014 , property(H.property)
18015 , block_type(H.block_type)
18016 , dot_node_id(H.dot_node_id)
18017 , submatrices(H.submatrices)
18019 , next_same_level_hmat_node(H.next_same_level_hmat_node)
18020 , next_same_level_same_row_hmat_node(H.next_same_level_same_row_hmat_node)
18021 , next_same_level_same_column_hmat_node(
18022 H.next_same_level_same_column_hmat_node)
18023 , previous_same_level_same_row_hmat_node(
18024 H.previous_same_level_same_row_hmat_node)
18025 , previous_same_level_same_column_hmat_node(
18026 H.previous_same_level_same_column_hmat_node)
18027 , submatrix_index(H.submatrix_index)
18028 , leaf_set(H.leaf_set)
18029 , near_field_leaf_set(H.near_field_leaf_set)
18030 , far_field_leaf_set(H.far_field_leaf_set)
18031 , rkmatrix(H.rkmatrix)
18032 , fullmatrix(H.fullmatrix)
18033 , bc_node(H.bc_node)
18034 , row_index_range(H.row_index_range)
18035 , col_index_range(H.col_index_range)
18038 , Tind(std::move(H.Tind))
18039 , Sigma_P(H.Sigma_P)
18040 , Sigma_R(H.Sigma_R)
18041 , Sigma_F(H.Sigma_F)
18043 H.clear_hmat_node();
18047template <
int spacedim,
typename Number>
18051 typename numbers::NumberTraits<Number>::real_type>
18053 const unsigned int fixed_rank_k,
18059 this->
property = property;
18060 this->block_type = block_type;
18067 link_hmat_nodes_on_same_levels();
18068 set_default_vmult_strategy();
18072template <
int spacedim,
typename Number>
18077 const unsigned int fixed_rank_k,
18083 this->
property = property;
18084 this->block_type = block_type;
18088 link_hmat_nodes_on_same_levels();
18089 set_default_vmult_strategy();
18093template <
int spacedim,
typename Number>
18104 H.clear_hmat_node();
18118 if (bc_node->is_root() && submatrices.size() == 0)
18123 ExcInvalidHMatrixType(type));
18131 set_default_vmult_strategy();
18138template <
int spacedim,
typename Number>
18145 link_hmat_nodes_on_same_levels();
18146 set_default_vmult_strategy();
18152template <
int spacedim,
typename Number>
18153template <
typename MatrixType>
18158 _convertToFullMatrix(M, property);
18163 set_property_for_converted_fullmatrix(M);
18167template <
int spacedim,
typename Number>
18168template <
typename MatrixType>
18179 Assert(fullmatrix, ExcInternalError());
18181 switch (top_hmat_property)
18183 case HMatrixSupport::Property::general: {
18188 M((*row_index_range)[0] + i,
18189 (*col_index_range)[0] + j) = (*fullmatrix)(i, j);
18195 case HMatrixSupport::Property::symmetric:
18196 case HMatrixSupport::Property::hermite_symmetric:
18197 case HMatrixSupport::Property::lower_triangular: {
18206 if (this->block_type ==
18207 HMatrixSupport::BlockType::diagonal_block)
18213 M((*row_index_range)[0] + i,
18214 (*col_index_range)[0] + j) = (*fullmatrix)(i, j);
18218 else if (this->block_type ==
18219 HMatrixSupport::BlockType::lower_triangular_block)
18225 M((*row_index_range)[0] + i,
18226 (*col_index_range)[0] + j) = (*fullmatrix)(i, j);
18233 case HMatrixSupport::Property::upper_triangular: {
18242 if (this->block_type ==
18243 HMatrixSupport::BlockType::diagonal_block)
18249 M((*row_index_range)[0] + i,
18250 (*col_index_range)[0] + j) = (*fullmatrix)(i, j);
18254 else if (this->block_type ==
18255 HMatrixSupport::BlockType::upper_triangular_block)
18261 M((*row_index_range)[0] + i,
18262 (*col_index_range)[0] + j) = (*fullmatrix)(i, j);
18270 Assert(
false, ExcInvalidHMatrixProperty(top_hmat_property));
18278 Assert(rkmatrix, ExcInternalError());
18280 switch (top_hmat_property)
18282 case HMatrixSupport::Property::general: {
18283 if (rkmatrix->convertToFullMatrix(matrix_block))
18293 M((*row_index_range)[0] + i,
18294 (*col_index_range)[0] + j) = matrix_block(i, j);
18301 case HMatrixSupport::Property::symmetric:
18302 case HMatrixSupport::Property::hermite_symmetric:
18303 case HMatrixSupport::Property::lower_triangular: {
18312 if (this->block_type ==
18313 HMatrixSupport::BlockType::diagonal_block)
18318 "Rank-k matrix cannot belong to the diagonal part!"));
18320 else if (this->block_type ==
18321 HMatrixSupport::BlockType::lower_triangular_block)
18323 if (rkmatrix->convertToFullMatrix(matrix_block))
18334 M((*row_index_range)[0] + i,
18335 (*col_index_range)[0] + j) =
18336 matrix_block(i, j);
18344 case HMatrixSupport::Property::upper_triangular: {
18353 if (this->block_type ==
18354 HMatrixSupport::BlockType::diagonal_block)
18359 "Rank-k matrix cannot belong to the diagonal part!"));
18361 else if (this->block_type ==
18362 HMatrixSupport::BlockType::upper_triangular_block)
18364 if (rkmatrix->convertToFullMatrix(matrix_block))
18375 M((*row_index_range)[0] + i,
18376 (*col_index_range)[0] + j) =
18377 matrix_block(i, j);
18386 Assert(
false, ExcInvalidHMatrixProperty(top_hmat_property));
18394 for (
HMatrix *submatrix : submatrices)
18396 submatrix->_convertToFullMatrix(M, top_hmat_property);
18401 Assert(
false, ExcInvalidHMatrixType(type));
18407template <
int spacedim,
typename Number>
18412 switch (top_hmat_property)
18414 case HMatrixSupport::Property::general:
18417 case HMatrixSupport::Property::symmetric:
18418 if (block_type == HMatrixSupport::BlockType::diagonal_block ||
18419 block_type == HMatrixSupport::BlockType::lower_triangular_block)
18428 case HMatrixSupport::Property::hermite_symmetric:
18429 if (block_type == HMatrixSupport::BlockType::diagonal_block ||
18430 block_type == HMatrixSupport::BlockType::lower_triangular_block)
18439 case HMatrixSupport::Property::upper_triangular:
18440 if (block_type == HMatrixSupport::BlockType::diagonal_block ||
18441 block_type == HMatrixSupport::BlockType::upper_triangular_block)
18450 case HMatrixSupport::Property::lower_triangular:
18451 if (block_type == HMatrixSupport::BlockType::diagonal_block ||
18452 block_type == HMatrixSupport::BlockType::lower_triangular_block)
18467template <
int spacedim,
typename Number>
18470 std::vector<HMatrix *> &total_leaf_set,
18471 std::vector<HMatrix *> &total_near_field_leaf_set,
18472 std::vector<HMatrix *> &total_far_field_leaf_set,
18475 if (is_current_hmat_node_nonemtpy(top_hmat_property))
18480 total_leaf_set.push_back(
const_cast<HMatrix *
>(
this));
18481 total_near_field_leaf_set.push_back(
const_cast<HMatrix *
>(
this));
18486 total_leaf_set.push_back(
const_cast<HMatrix *
>(
this));
18487 total_far_field_leaf_set.push_back(
const_cast<HMatrix *
>(
this));
18492 for (
HMatrix *submatrix : submatrices)
18494 submatrix->_build_leaf_set_z_traversal(
18496 total_near_field_leaf_set,
18497 total_far_field_leaf_set,
18498 top_hmat_property);
18504 Assert(
false, ExcInvalidHMatrixType(type));
18513template <
int spacedim,
typename Number>
18516 std::vector<HMatrix *> &total_leaf_set,
18517 std::vector<HMatrix *> &total_near_field_leaf_set,
18518 std::vector<HMatrix *> &total_far_field_leaf_set,
18522 if (is_current_hmat_node_nonemtpy(top_hmat_property))
18527 total_leaf_set.push_back(
const_cast<HMatrix *
>(
this));
18528 total_near_field_leaf_set.push_back(
const_cast<HMatrix *
>(
this));
18533 total_leaf_set.push_back(
const_cast<HMatrix *
>(
this));
18534 total_far_field_leaf_set.push_back(
const_cast<HMatrix *
>(
this));
18542 AssertDimension(submatrices.size(), 4);
18544 switch (current_hilbert_block_type)
18546 case HilbertBlockType::A: {
18547 submatrices[2]->_build_leaf_set_hilbert_traversal(
18549 total_near_field_leaf_set,
18550 total_far_field_leaf_set,
18551 HilbertBlockType::B,
18552 top_hmat_property);
18554 submatrices[0]->_build_leaf_set_hilbert_traversal(
18556 total_near_field_leaf_set,
18557 total_far_field_leaf_set,
18558 HilbertBlockType::A,
18559 top_hmat_property);
18561 submatrices[1]->_build_leaf_set_hilbert_traversal(
18563 total_near_field_leaf_set,
18564 total_far_field_leaf_set,
18565 HilbertBlockType::A,
18566 top_hmat_property);
18568 submatrices[3]->_build_leaf_set_hilbert_traversal(
18570 total_near_field_leaf_set,
18571 total_far_field_leaf_set,
18572 HilbertBlockType::C,
18573 top_hmat_property);
18577 case HilbertBlockType::B: {
18578 submatrices[2]->_build_leaf_set_hilbert_traversal(
18580 total_near_field_leaf_set,
18581 total_far_field_leaf_set,
18582 HilbertBlockType::A,
18583 top_hmat_property);
18585 submatrices[3]->_build_leaf_set_hilbert_traversal(
18587 total_near_field_leaf_set,
18588 total_far_field_leaf_set,
18589 HilbertBlockType::B,
18590 top_hmat_property);
18592 submatrices[1]->_build_leaf_set_hilbert_traversal(
18594 total_near_field_leaf_set,
18595 total_far_field_leaf_set,
18596 HilbertBlockType::B,
18597 top_hmat_property);
18599 submatrices[0]->_build_leaf_set_hilbert_traversal(
18601 total_near_field_leaf_set,
18602 total_far_field_leaf_set,
18603 HilbertBlockType::D,
18604 top_hmat_property);
18608 case HilbertBlockType::C: {
18609 submatrices[1]->_build_leaf_set_hilbert_traversal(
18611 total_near_field_leaf_set,
18612 total_far_field_leaf_set,
18613 HilbertBlockType::D,
18614 top_hmat_property);
18616 submatrices[0]->_build_leaf_set_hilbert_traversal(
18618 total_near_field_leaf_set,
18619 total_far_field_leaf_set,
18620 HilbertBlockType::C,
18621 top_hmat_property);
18623 submatrices[2]->_build_leaf_set_hilbert_traversal(
18625 total_near_field_leaf_set,
18626 total_far_field_leaf_set,
18627 HilbertBlockType::C,
18628 top_hmat_property);
18630 submatrices[3]->_build_leaf_set_hilbert_traversal(
18632 total_near_field_leaf_set,
18633 total_far_field_leaf_set,
18634 HilbertBlockType::A,
18635 top_hmat_property);
18639 case HilbertBlockType::D: {
18640 submatrices[1]->_build_leaf_set_hilbert_traversal(
18642 total_near_field_leaf_set,
18643 total_far_field_leaf_set,
18644 HilbertBlockType::C,
18645 top_hmat_property);
18647 submatrices[3]->_build_leaf_set_hilbert_traversal(
18649 total_near_field_leaf_set,
18650 total_far_field_leaf_set,
18651 HilbertBlockType::D,
18652 top_hmat_property);
18654 submatrices[2]->_build_leaf_set_hilbert_traversal(
18656 total_near_field_leaf_set,
18657 total_far_field_leaf_set,
18658 HilbertBlockType::D,
18659 top_hmat_property);
18661 submatrices[0]->_build_leaf_set_hilbert_traversal(
18663 total_near_field_leaf_set,
18664 total_far_field_leaf_set,
18665 HilbertBlockType::B,
18666 top_hmat_property);
18675 Assert(
false, ExcInvalidHMatrixType(type));
18684template <
int spacedim,
typename Number>
18688 const unsigned int fixed_rank)
18693 if (submatrices.size() > 0)
18706 distribute_sigma_r_and_f_to_leaves(fixed_rank);
18715 Assert(submatrix, ExcInternalError());
18717 submatrix->distribute_all_non_leaf_nodes_sigma_r_and_f_to_leaves(
18724template <
int spacedim,
typename Number>
18727 const unsigned int fixed_rank)
18729 if (Sigma_R.size() > 0 || Sigma_F.size() > 0)
18731 _distribute_sigma_r_and_f_to_leaves(*
this, fixed_rank);
18733 for (
auto &rkmatrix_in_starting_hmat : Sigma_R)
18735 if (rkmatrix_in_starting_hmat !=
nullptr)
18737 delete rkmatrix_in_starting_hmat;
18738 rkmatrix_in_starting_hmat =
nullptr;
18744 for (
auto &fullmatrix_in_starting_hmat : Sigma_F)
18746 if (fullmatrix_in_starting_hmat !=
nullptr)
18748 delete fullmatrix_in_starting_hmat;
18749 fullmatrix_in_starting_hmat =
nullptr;
18758template <
int spacedim,
typename Number>
18762 const unsigned int fixed_rank)
18764 if (submatrices.size() > 0)
18768 submatrix->_distribute_sigma_r_and_f_to_leaves(starting_hmat,
18784 Assert(rkmatrix_in_starting_hmat, ExcInternalError());
18791 fullmatrix_restricted,
18795 fullmatrix->add(fullmatrix_restricted);
18805 Assert(fullmatrix_in_starting_hmat, ExcInternalError());
18810 *fullmatrix_in_starting_hmat,
18814 fullmatrix->add(fullmatrix_restricted);
18827 Assert(rkmatrix_in_starting_hmat, ExcInternalError());
18832 *rkmatrix_in_starting_hmat,
18836 if (fixed_rank == 0)
18838 rkmatrix->add(rkmatrix_restricted);
18842 rkmatrix->add(rkmatrix_restricted, fixed_rank);
18853 Assert(fullmatrix_in_starting_hmat, ExcInternalError());
18858 *fullmatrix_in_starting_hmat,
18862 if (fixed_rank == 0)
18864 rkmatrix->add(rkmatrix_restricted);
18868 rkmatrix->add(rkmatrix_restricted, fixed_rank);
18875 Assert(
false, ExcInvalidHMatrixType(type));
18883template <
int spacedim,
typename Number>
18887 if (rkmatrix !=
nullptr)
18890 rkmatrix =
nullptr;
18893 if (fullmatrix !=
nullptr)
18896 fullmatrix =
nullptr;
18899 for (
auto submatrix : submatrices)
18907 if (submatrix !=
nullptr)
18913 submatrices.clear();
18915 near_field_leaf_set.clear();
18916 far_field_leaf_set.clear();
18919 state = HMatrixSupport::State::matrix;
18920 property = HMatrixSupport::Property::general,
18921 block_type = HMatrixSupport::BlockType::undefined_block;
18925 next_same_level_hmat_node =
nullptr;
18926 next_same_level_same_row_hmat_node =
nullptr;
18927 next_same_level_same_column_hmat_node =
nullptr;
18928 previous_same_level_same_row_hmat_node =
nullptr;
18929 previous_same_level_same_column_hmat_node =
nullptr;
18930 submatrix_index = submatrix_index_invalid;
18931 row_index_range =
nullptr;
18932 col_index_range =
nullptr;
18938 for (
auto &r : Sigma_R)
18948 for (
auto &f : Sigma_F)
18962template <
int spacedim,
typename Number>
18969 if (submatrices.size() > 0)
18973 for (
HMatrix *submatrix : submatrices)
18975 submatrix->clear();
18986template <
int spacedim,
typename Number>
18991 state = HMatrixSupport::State::matrix;
18992 property = HMatrixSupport::Property::general;
18993 block_type = HMatrixSupport::BlockType::undefined_block;
18995 submatrices.clear();
18997 next_same_level_hmat_node =
nullptr;
18998 next_same_level_same_row_hmat_node =
nullptr;
18999 next_same_level_same_column_hmat_node =
nullptr;
19000 previous_same_level_same_row_hmat_node =
nullptr;
19001 previous_same_level_same_column_hmat_node =
nullptr;
19002 submatrix_index = submatrix_index_invalid;
19004 near_field_leaf_set.clear();
19005 far_field_leaf_set.clear();
19006 rkmatrix =
nullptr;
19007 fullmatrix =
nullptr;
19009 row_index_range =
nullptr;
19010 col_index_range =
nullptr;
19020template <
int spacedim,
typename Number>
19024 for (
auto submatrix : submatrices)
19026 submatrix->clear_lu_or_cholesky_task_nodes();
19029 clear_lu_or_cholesky_task_nodes_in_hmat();
19033template <
int spacedim,
typename Number>
19037 factorize_lu_or_cholesky_graph_node.reset();
19038 update_lu_or_cholesky_graph_nodes.clear();
19039 solve_upper_or_lower_lu_or_cholesky_graph_node.reset();
19043template <
int spacedim,
typename Number>
19050template <
int spacedim,
typename Number>
19058template <
int spacedim,
typename Number>
19062 return bc_node->is_root();
19066template <
int spacedim,
typename Number>
19074template <
int spacedim,
typename Number>
19082template <
int spacedim,
typename Number>
19091template <
int spacedim,
typename Number>
19099template <
int spacedim,
typename Number>
19104 bc_node->get_data_reference().get_tau_node()->get_child_num() :
19109template <
int spacedim,
typename Number>
19114 bc_node->get_data_reference().get_sigma_node()->get_child_num() :
19119template <
int spacedim,
typename Number>
19127template <
int spacedim,
typename Number>
19132 this->
property = property;
19136template <
int spacedim,
typename Number>
19143 case LAPACKSupport::Property::general: {
19144 property = HMatrixSupport::Property::general;
19148 case LAPACKSupport::Property::symmetric: {
19149 property = HMatrixSupport::Property::symmetric;
19153 case LAPACKSupport::Property::hermite_symmetric: {
19154 property = HMatrixSupport::Property::hermite_symmetric;
19158 case LAPACKSupport::Property::upper_triangular: {
19159 property = HMatrixSupport::Property::upper_triangular;
19163 case LAPACKSupport::Property::lower_triangular: {
19164 property = HMatrixSupport::Property::lower_triangular;
19169 Assert(
false, ExcNotImplemented());
19176template <
int spacedim,
typename Number>
19182 case HMatrixSupport::Property::general: {
19191 this->set_current_matrix_property(property);
19198 hmat->set_property(property);
19203 case HMatrixSupport::Property::symmetric: {
19209 block_type == HMatrixSupport::BlockType::diagonal_block,
19211 "A symmetric H-matrix node should belong to the diagonal part!"));
19213 this->set_current_matrix_property(property);
19215 if (submatrices.size() > 0)
19226 Assert(submatrices.size() ==
19228 ExcDimensionMismatch(
19229 submatrices.size(),
19248 submatrices[0]->block_type ==
19249 HMatrixSupport::BlockType::diagonal_block,
19251 "The first child matrix should belong to the diagonal part!"));
19253 submatrices[1]->block_type ==
19254 HMatrixSupport::BlockType::upper_triangular_block,
19256 "The second child matrix should belong to the upper triangular part!"));
19258 submatrices[2]->block_type ==
19259 HMatrixSupport::BlockType::lower_triangular_block,
19261 "The third child matrix should belong to the lower triangular part!"));
19263 submatrices[3]->block_type ==
19264 HMatrixSupport::BlockType::diagonal_block,
19266 "The fourth child matrix should belong to the diagonal part!"));
19272 submatrices[0]->set_property(this->property);
19273 submatrices[1]->set_property(HMatrixSupport::Property::general);
19274 submatrices[2]->set_property(HMatrixSupport::Property::general);
19275 submatrices[3]->set_property(this->property);
19285 this->fullmatrix->set_property(
19286 LAPACKSupport::Property::symmetric);
19291 case HMatrixSupport::Property::hermite_symmetric: {
19297 block_type == HMatrixSupport::BlockType::diagonal_block,
19299 "An Hermite symmetric H-matrix node should belong to the diagonal part!"));
19301 this->set_current_matrix_property(property);
19303 if (submatrices.size() > 0)
19314 Assert(submatrices.size() ==
19316 ExcDimensionMismatch(
19317 submatrices.size(),
19336 submatrices[0]->block_type ==
19337 HMatrixSupport::BlockType::diagonal_block,
19339 "The first child matrix should belong to the diagonal part!"));
19341 submatrices[1]->block_type ==
19342 HMatrixSupport::BlockType::upper_triangular_block,
19344 "The second child matrix should belong to the upper triangular part!"));
19346 submatrices[2]->block_type ==
19347 HMatrixSupport::BlockType::lower_triangular_block,
19349 "The third child matrix should belong to the lower triangular part!"));
19351 submatrices[3]->block_type ==
19352 HMatrixSupport::BlockType::diagonal_block,
19354 "The fourth child matrix should belong to the diagonal part!"));
19360 submatrices[0]->set_property(this->property);
19361 submatrices[1]->set_property(HMatrixSupport::Property::general);
19362 submatrices[2]->set_property(HMatrixSupport::Property::general);
19363 submatrices[3]->set_property(this->property);
19373 this->fullmatrix->set_property(
19374 LAPACKSupport::Property::hermite_symmetric);
19379 case HMatrixSupport::Property::upper_triangular: {
19385 block_type == HMatrixSupport::BlockType::diagonal_block,
19387 "An upper triangular H-matrix node should belong to the diagonal part!"));
19389 this->set_current_matrix_property(property);
19391 if (submatrices.size() > 0)
19402 Assert(submatrices.size() ==
19404 ExcDimensionMismatch(
19405 submatrices.size(),
19416 submatrices[0]->block_type ==
19417 HMatrixSupport::BlockType::diagonal_block,
19419 "The first child matrix should belong to the diagonal part!"));
19421 submatrices[1]->block_type ==
19422 HMatrixSupport::BlockType::upper_triangular_block,
19424 "The second child matrix should belong to the upper triangular part!"));
19426 submatrices[2]->block_type ==
19427 HMatrixSupport::BlockType::lower_triangular_block,
19429 "The third child matrix should belong to the lower triangular part!"));
19431 submatrices[3]->block_type ==
19432 HMatrixSupport::BlockType::diagonal_block,
19434 "The fourth child matrix should belong to the diagonal part!"));
19440 submatrices[0]->set_property(this->property);
19441 submatrices[1]->set_property(HMatrixSupport::Property::general);
19442 submatrices[2]->set_property(HMatrixSupport::Property::general);
19443 submatrices[3]->set_property(this->property);
19453 this->fullmatrix->set_property(
19454 LAPACKSupport::Property::upper_triangular);
19459 case HMatrixSupport::Property::lower_triangular: {
19465 block_type == HMatrixSupport::BlockType::diagonal_block,
19467 "A lower triangular H-matrix node should belong to the diagonal part!"));
19469 this->set_current_matrix_property(property);
19471 if (submatrices.size() > 0)
19482 Assert(submatrices.size() ==
19484 ExcDimensionMismatch(
19485 submatrices.size(),
19496 submatrices[0]->block_type ==
19497 HMatrixSupport::BlockType::diagonal_block,
19499 "The first child matrix should belong to the diagonal part!"));
19501 submatrices[1]->block_type ==
19502 HMatrixSupport::BlockType::upper_triangular_block,
19504 "The second child matrix should belong to the upper triangular part!"));
19506 submatrices[2]->block_type ==
19507 HMatrixSupport::BlockType::lower_triangular_block,
19509 "The third child matrix should belong to the lower triangular part!"));
19511 submatrices[3]->block_type ==
19512 HMatrixSupport::BlockType::diagonal_block,
19514 "The fourth child matrix should belong to the diagonal part!"));
19520 submatrices[0]->set_property(this->property);
19521 submatrices[1]->set_property(HMatrixSupport::Property::general);
19522 submatrices[2]->set_property(HMatrixSupport::Property::general);
19523 submatrices[3]->set_property(this->property);
19533 this->fullmatrix->set_property(
19534 LAPACKSupport::Property::lower_triangular);
19542 std::string(
"Invalid H-matrix property: ") +
19543 std::string(HMatrixSupport::property_name(property))));
19550template <
int spacedim,
typename Number>
19557 this->set_current_matrix_property(M);
19559 this->set_property(this->property);
19563template <
int spacedim,
typename Number>
19568 this->state = state;
19575 switch (this->state)
19577 case HMatrixSupport::State::matrix: {
19578 fullmatrix->set_state(LAPACKSupport::matrix);
19582 case HMatrixSupport::inverse_matrix: {
19583 fullmatrix->set_state(LAPACKSupport::inverse_matrix);
19587 case HMatrixSupport::lu: {
19588 fullmatrix->set_state(LAPACKSupport::lu);
19592 case HMatrixSupport::cholesky: {
19593 fullmatrix->set_state(LAPACKSupport::cholesky);
19597 case HMatrixSupport::eigenvalues: {
19598 fullmatrix->set_state(LAPACKSupport::eigenvalues);
19602 case HMatrixSupport::svd: {
19603 fullmatrix->set_state(LAPACKSupport::svd);
19607 case HMatrixSupport::inverse_svd: {
19608 fullmatrix->set_state(LAPACKSupport::inverse_svd);
19612 case HMatrixSupport::unusable: {
19613 fullmatrix->set_state(LAPACKSupport::unusable);
19620 std::string(
"Invalid H-matrix state ") +
19621 std::string(HMatrixSupport::state_name(this->state))));
19630template <
int spacedim,
typename Number>
19638template <
int spacedim,
typename Number>
19642 this->set_current_matrix_state(state);
19647 for (
auto hmat : submatrices)
19649 hmat->set_state(this->state);
19654template <
int spacedim,
typename Number>
19662template <
int spacedim,
typename Number>
19667 this->block_type = block_type;
19671template <
int spacedim,
typename Number>
19676 this->set_current_matrix_block_type(block_type);
19678 for (
unsigned int i = 0; i < submatrices.size(); i++)
19680 switch (block_type)
19682 case HMatrixSupport::BlockType::undefined_block: {
19687 submatrices[i]->set_block_type(block_type);
19691 case HMatrixSupport::BlockType::diagonal_block: {
19701 submatrices[i]->set_block_type(
19702 HMatrixSupport::BlockType::diagonal_block);
19707 submatrices[i]->set_block_type(
19708 HMatrixSupport::BlockType::upper_triangular_block);
19713 submatrices[i]->set_block_type(
19714 HMatrixSupport::BlockType::lower_triangular_block);
19719 submatrices[i]->set_block_type(
19720 HMatrixSupport::BlockType::diagonal_block);
19725 Assert(
false, ExcNotImplemented());
19732 case HMatrixSupport::BlockType::upper_triangular_block: {
19737 submatrices[i]->set_block_type(block_type);
19741 case HMatrixSupport::BlockType::lower_triangular_block: {
19746 submatrices[i]->set_block_type(block_type);
19752 ExcMessage(std::string(
"Invalid block type ") +
19753 std::string(HMatrixSupport::block_type_name(
19762template <
int spacedim,
typename Number>
19770template <
int spacedim,
typename Number>
19778template <
int spacedim,
typename Number>
19786template <
int spacedim,
typename Number>
19793 for (
HMatrix *submatrix : submatrices)
19795 submatrix->calc_rank_upper_bound_for_rkmatrices();
19801 this->rkmatrix->calc_rank_upper_bound();
19813template <
int spacedim,
typename Number>
19821template <
int spacedim,
typename Number>
19829template <
int spacedim,
typename Number>
19830inline std::vector<HMatrix<spacedim, Number> *> &
19833 return submatrices;
19837template <
int spacedim,
typename Number>
19838inline const std::vector<HMatrix<spacedim, Number> *> &
19841 return submatrices;
19845template <
int spacedim,
typename Number>
19848 const unsigned int precision,
19849 const bool scientific,
19850 const unsigned int width,
19851 const char *zero_string,
19852 const double denominator,
19853 const double threshold)
const
19858 fullmatrix->print_formatted(out,
19868 rkmatrix->print_formatted(out,
19878 for (
HMatrix *submatrix : submatrices)
19880 submatrix->print_formatted(out,
19892 Assert(
false, ExcInvalidHMatrixType(type));
19898template <
int spacedim,
typename Number>
19902 print_current_matrix_info(out);
19906 submatrix->print_matrix_info(out);
19911template <
int spacedim,
typename Number>
19915 out <<
"H-matrix address: " << std::hex <<
this <<
"\n";
19916 out <<
"Parent H-matrix address: " << std::hex << this->parent <<
"\n";
19917 out <<
"Submatrix addresses: (";
19918 for (
unsigned int i = 0; i < submatrices.size(); i++)
19920 out << std::hex << submatrices[i];
19922 if (i < submatrices.size() - 1)
19928 out <<
"Submatrix index wrt. the parent H-matrix: " << std::dec
19929 << this->submatrix_index <<
"\n";
19930 out <<
"H-matrix state: " << HMatrixSupport::state_name(this->state) <<
"\n"
19931 <<
"H-matrix property: " << HMatrixSupport::property_name(this->property)
19933 <<
"H-matrix block type: "
19934 << HMatrixSupport::block_type_name(this->block_type) << std::endl;
19940 print_h_submatrix_accessor(out,
"M", *
this);
19942 out <<
"(#level, #Sigma_b^P, #Sigma_b^R, #Sigma_b^F)=("
19943 << bc_node->get_level() <<
"," << Sigma_P.size() <<
"," << Sigma_R.size()
19944 <<
"," << Sigma_F.size() <<
")" << std::endl;
19947 hmat_pair : Sigma_P)
19949 out <<
" Sigma_P products: ";
19950 print_h_h_submatrix_mmult_accessor(
19951 out,
"M1", *(hmat_pair.first),
"M2", *(hmat_pair.second));
19956template <
int spacedim,
typename Number>
19960 assign_node_ids_for_dot();
19965 out <<
"#@startdot\n";
19966 out <<
"digraph hmatrix {\n";
19971 out <<
"node [style=filled, shape=box]\n";
19976 out <<
"\"Non-leaf block\" [fillcolor=white]\n";
19977 out <<
"\"Near field block\" [fillcolor=red]\n";
19978 out <<
"\"Far field block\" [fillcolor=green]\n";
19980 _print_matrix_info_as_dot_node(out);
19986 out <<
"#@enddot" << std::endl;
19990template <
int spacedim,
typename Number>
19994 const std::string &name,
19995 const unsigned int precision,
19996 const bool scientific,
19997 const unsigned int width,
19998 const char *zero_string,
19999 const double denominator,
20000 const double threshold)
const
20003 this->convertToFullMatrix(fullmat);
20015template <
int spacedim,
typename Number>
20023 types::global_dof_index near_field_matrix_entries_num = 0;
20024 for (
auto mat : near_field_leaf_set)
20026 Assert(mat->fullmatrix !=
nullptr, ExcInternalError());
20028 near_field_matrix_entries_num +=
20029 mat->fullmatrix->m() * mat->fullmatrix->n();
20036 types::global_dof_index far_field_matrix_entries_num = 0;
20037 for (
auto mat : far_field_leaf_set)
20039 Assert(mat->rkmatrix !=
nullptr, ExcInternalError());
20041 far_field_matrix_entries_num +=
20042 (mat->rkmatrix->get_m() + mat->rkmatrix->get_n()) *
20043 mat->rkmatrix->get_formal_rank();
20046 out <<
"Number of H-matrix nodes in the leaf set: " << leaf_set.size() <<
"\n"
20047 <<
"Number of H-matrix nodes in the near field set: "
20048 << near_field_leaf_set.size() <<
"\n"
20049 <<
"Number of H-matrix nodes in the far field set: "
20050 << far_field_leaf_set.size() <<
"\n"
20051 <<
"Number of matrix entries in the near field set: "
20052 << near_field_matrix_entries_num <<
"\n"
20053 <<
"Maximum number of matrix entries in the far field set: "
20054 << far_field_matrix_entries_num << std::endl;
20058template <
int spacedim,
typename Number>
20064 std::queue<HMatrix<spacedim, Number> *> work_queue;
20065 work_queue.push(
this);
20067 while (!work_queue.empty())
20072 current_hmat_node->
dot_node_id = current_node_id;
20081 work_queue.push(hmat);
20087template <
int spacedim,
typename Number>
20090 std::ostream &out)
const
20097 out <<
"\"" << dot_node_id <<
"\""
20098 <<
"[label=<<b>ID: " << dot_node_id <<
"</b><br/>"
20099 <<
"tau: [" << (*row_index_range)[0] <<
"," << (*row_index_range)[1]
20101 out <<
"sigma: [" << (*col_index_range)[0] <<
"," << (*col_index_range)[1]
20103 out <<
"Level: " << bc_node->get_level() <<
"<br/>";
20104 out <<
"Parent: " << ((parent ==
nullptr) ? 0 : parent->dot_node_id)
20106 out <<
"Submatrix index: " << submatrix_index <<
"<br/>";
20107 out <<
"H-matrix state: " << HMatrixSupport::state_name(state) <<
"<br/>"
20108 <<
"H-matrix property: " << HMatrixSupport::property_name(property)
20110 <<
"H-matrix block type: " << HMatrixSupport::block_type_name(block_type)
20113 std::string node_color;
20117 node_color =
"red";
20121 node_color =
"green";
20125 node_color =
"white";
20127 out <<
"fillcolor = " << node_color <<
"]\n\n";
20134 Assert(submatrix !=
nullptr, ExcInternalError());
20136 out <<
"\"" << dot_node_id <<
"\""
20138 <<
"\"" << submatrix->dot_node_id <<
"\"\n";
20146 if (next_same_level_hmat_node !=
nullptr)
20148 out <<
"\"" << dot_node_id <<
"\""
20150 <<
"\"" << next_same_level_hmat_node->dot_node_id
20151 <<
"\" [style=dotted]\n";
20159 if (next_same_level_same_row_hmat_node !=
nullptr)
20161 out <<
"\"" << dot_node_id <<
"\""
20163 <<
"\"" << next_same_level_same_row_hmat_node->dot_node_id
20164 <<
"\" [style=solid,color=red]\n";
20167 if (previous_same_level_same_row_hmat_node !=
nullptr)
20169 out <<
"\"" << dot_node_id <<
"\""
20171 <<
"\"" << previous_same_level_same_row_hmat_node->dot_node_id
20172 <<
"\" [style=dotted,color=red]\n";
20180 if (next_same_level_same_column_hmat_node !=
nullptr)
20182 out <<
"\"" << dot_node_id <<
"\""
20184 <<
"\"" << next_same_level_same_column_hmat_node->dot_node_id
20185 <<
"\" [style=solid,color=green]\n";
20188 if (previous_same_level_same_column_hmat_node !=
nullptr)
20190 out <<
"\"" << dot_node_id <<
"\""
20192 <<
"\"" << previous_same_level_same_column_hmat_node->dot_node_id
20193 <<
"\" [style=dotted,color=green]\n";
20201 Assert(submatrix !=
nullptr, ExcInternalError());
20203 submatrix->_print_matrix_info_as_dot_node(out);
20208template <
int spacedim,
typename Number>
20215 case HMatrixSupport::Property::general: {
20220 case HMatrixSupport::Property::symmetric: {
20225 case HMatrixSupport::Property::hermite_symmetric: {
20226 M.
set_property(LAPACKSupport::Property::hermite_symmetric);
20230 case HMatrixSupport::Property::upper_triangular: {
20231 M.
set_property(LAPACKSupport::Property::upper_triangular);
20235 case HMatrixSupport::Property::lower_triangular: {
20236 M.
set_property(LAPACKSupport::Property::lower_triangular);
20241 Assert(
false, ExcInvalidHMatrixProperty(property));
20248template <
int spacedim,
typename Number>
20252 const real_type singular_value_threshold)
const
20256 const std::array<types::global_dof_index, 2> &tau_index_range =
20257 bc_node->get_data_reference()
20259 ->get_data_reference()
20260 .get_index_range();
20261 const std::array<types::global_dof_index, 2> &sigma_index_range =
20262 bc_node->get_data_reference()
20264 ->get_data_reference()
20265 .get_index_range();
20271 print_vector_values(out, tau_index_range,
" ",
false);
20278 print_vector_values(out, sigma_index_range,
" ",
false);
20284 out << (bc_node->get_data_reference().get_is_near_field() ? 1 : 0) <<
",";
20294 if (copy.get_state() != LAPACKSupport::matrix)
20296 copy.set_state(LAPACKSupport::matrix);
20299 const size_t rank = copy.rank(singular_value_threshold);
20304 out << rank <<
"\n";
20308template <
int spacedim,
typename Number>
20312 Assert(type ==
RkMatrixType, ExcInvalidHMatrixType(type));
20314 const std::array<types::global_dof_index, 2> &tau_index_range =
20315 bc_node->get_data_reference()
20317 ->get_data_reference()
20318 .get_index_range();
20319 const std::array<types::global_dof_index, 2> &sigma_index_range =
20320 bc_node->get_data_reference()
20322 ->get_data_reference()
20323 .get_index_range();
20329 print_vector_values(out, tau_index_range,
" ",
false);
20336 print_vector_values(out, sigma_index_range,
" ",
false);
20342 out << (bc_node->get_data_reference().get_is_near_field() ? 1 : 0) <<
",";
20347 out << rkmatrix->get_rank() <<
"\n";
20351template <
int spacedim,
typename Number>
20355 const real_type singular_value_threshold)
const
20360 write_fullmatrix_leaf_node(out, singular_value_threshold);
20365 write_rkmatrix_leaf_node(out);
20370 for (
HMatrix *submatrix : submatrices)
20372 submatrix->write_leaf_set(out);
20378 Assert(
false, ExcInvalidHMatrixType(type));
20386template <
int spacedim,
typename Number>
20390 const real_type singular_value_threshold)
const
20392 for (
HMatrix *leaf_node : leaf_set)
20394 switch (leaf_node->type)
20397 leaf_node->write_fullmatrix_leaf_node(out,
20398 singular_value_threshold);
20403 leaf_node->write_rkmatrix_leaf_node(out);
20408 Assert(
false, ExcInvalidHMatrixType(type));
20417template <
int spacedim,
typename Number>
20428 "The current H-matrix node, the diagonal block of which on a same row is to be found, should not be on the top level!"));
20451 std::vector<unsigned int> submatrix_index_stack;
20452 submatrix_index_stack.reserve(this->bc_node->get_level());
20455 bool is_recursion_continued =
true;
20456 while (is_recursion_continued)
20458 if (current_hmat_during_recursion->
parent ==
nullptr)
20464 Assert(
false, ExcInternalError());
20465 is_recursion_continued =
false;
20483 if (current_hmat_during_recursion->
parent->submatrices[0]
20485 HMatrixSupport::BlockType::diagonal_block)
20487 current_hmat_during_recursion =
20488 current_hmat_during_recursion->
parent->submatrices[0];
20489 is_recursion_continued =
false;
20496 submatrix_index_stack.push_back(
20498 current_hmat_during_recursion =
20499 current_hmat_during_recursion->
parent;
20509 if (current_hmat_during_recursion->
parent->submatrices[3]
20511 HMatrixSupport::BlockType::diagonal_block)
20513 current_hmat_during_recursion =
20514 current_hmat_during_recursion->
parent->submatrices[3];
20515 is_recursion_continued =
false;
20522 submatrix_index_stack.push_back(
20524 current_hmat_during_recursion =
20525 current_hmat_during_recursion->
parent;
20532 current_hmat_during_recursion->
block_type !=
20533 HMatrixSupport::BlockType::diagonal_block,
20535 "The current H-matrix node should not be a diagonal block!"));
20540 submatrix_index_stack.push_back(
20542 current_hmat_during_recursion =
20543 current_hmat_during_recursion->
parent;
20551 const unsigned int iter_num = submatrix_index_stack.size();
20552 for (
unsigned int i = 0; i < iter_num; i++)
20554 switch (submatrix_index_stack.back())
20558 current_hmat_during_recursion =
20565 current_hmat_during_recursion =
20572 submatrix_index_stack.pop_back();
20575 return current_hmat_during_recursion;
20579template <
int spacedim,
typename Number>
20590 "The current H-matrix node, the diagonal block of which on a same row is to be found, should not be on the top level!"));
20613 std::vector<unsigned int> submatrix_index_stack;
20614 submatrix_index_stack.reserve(this->bc_node->get_level());
20617 bool is_recursion_continued =
true;
20618 while (is_recursion_continued)
20620 if (current_hmat_during_recursion->
parent ==
nullptr)
20627 Assert(
false, ExcInternalError());
20628 is_recursion_continued =
false;
20646 if (current_hmat_during_recursion->
parent->submatrices[3]
20648 HMatrixSupport::BlockType::diagonal_block)
20650 current_hmat_during_recursion =
20651 current_hmat_during_recursion->
parent->submatrices[3];
20652 is_recursion_continued =
false;
20659 submatrix_index_stack.push_back(
20661 current_hmat_during_recursion =
20662 current_hmat_during_recursion->
parent;
20672 if (current_hmat_during_recursion->
parent->submatrices[0]
20674 HMatrixSupport::BlockType::diagonal_block)
20676 current_hmat_during_recursion =
20677 current_hmat_during_recursion->
parent->submatrices[0];
20678 is_recursion_continued =
false;
20685 submatrix_index_stack.push_back(
20687 current_hmat_during_recursion =
20688 current_hmat_during_recursion->
parent;
20695 current_hmat_during_recursion->
block_type !=
20696 HMatrixSupport::BlockType::diagonal_block,
20698 "The current H-matrix node should not be a diagonal block!"));
20703 submatrix_index_stack.push_back(
20705 current_hmat_during_recursion =
20706 current_hmat_during_recursion->
parent;
20714 const unsigned int iter_num = submatrix_index_stack.size();
20715 for (
unsigned int i = 0; i < iter_num; i++)
20717 switch (submatrix_index_stack.back())
20721 current_hmat_during_recursion =
20728 current_hmat_during_recursion =
20735 submatrix_index_stack.pop_back();
20738 return current_hmat_during_recursion;
20742template <
int spacedim,
typename Number>
20749 for (
HMatrix *submatrix : submatrices)
20751 submatrix->truncate_to_rank(new_rank);
20767 rkmatrix->truncate_to_rank(new_rank);
20773 Assert(
false, ExcInvalidHMatrixType(type));
20780template <
int spacedim,
typename Number>
20784 const bool is_only_handle_tril)
20786 truncate_to_rank_diag_preserve_positive_definite(new_rank,
20787 is_only_handle_tril);
20791template <
int spacedim,
typename Number>
20795 const bool is_only_handle_tril)
20802 AssertDimension(submatrices.size(), 4);
20809 submatrices[0]->block_type == HMatrixSupport::BlockType::diagonal_block,
20811 "The first submatrix of the current H-matrix node is not a diagonal block!"));
20813 submatrices[3]->block_type == HMatrixSupport::BlockType::diagonal_block,
20815 "The last submatrix of the current H-matrix node is not a diagonal block!"));
20817 switch (submatrices[0]->type)
20820 submatrices[0]->truncate_to_rank_diag_preserve_positive_definite(
20821 new_rank, is_only_handle_tril);
20836 Assert(
false, ExcInvalidHMatrixType(type));
20841 switch (submatrices[3]->type)
20844 submatrices[3]->truncate_to_rank_diag_preserve_positive_definite(
20845 new_rank, is_only_handle_tril);
20860 Assert(
false, ExcInvalidHMatrixType(type));
20865 if (!is_only_handle_tril)
20867 switch (submatrices[1]->type)
20871 ->truncate_to_rank_off_diag_preserve_positive_definite(new_rank,
20878 submatrices[1]->rkmatrix->truncate_to_rank(new_rank, D, C);
20902 Assert(
false, ExcInvalidHMatrixType(type));
20908 switch (submatrices[2]->type)
20911 submatrices[2]->truncate_to_rank_off_diag_preserve_positive_definite(
20918 submatrices[2]->rkmatrix->truncate_to_rank(new_rank, D, C);
20925 submatrices[0]->addsym_diag(C);
20926 submatrices[3]->addsym_diag(D);
20942 Assert(
false, ExcInvalidHMatrixType(type));
20949template <
int spacedim,
typename Number>
20953 const bool is_compensate_diag_blocks)
20960 AssertDimension(submatrices.size(), 4);
20965 for (
HMatrix *submatrix : submatrices)
20967 switch (submatrix->type)
20970 submatrix->truncate_to_rank_off_diag_preserve_positive_definite(
20971 new_rank, is_compensate_diag_blocks);
20983 submatrix->rkmatrix->truncate_to_rank(new_rank, D, C);
20985 if (is_compensate_diag_blocks)
20993 Assert(diag_upper_left != submatrix, ExcInternalError());
20994 Assert(diag_upper_left !=
nullptr, ExcInternalError());
21001 Assert(diag_bottom_right != submatrix, ExcInternalError());
21002 Assert(diag_bottom_right !=
nullptr, ExcInternalError());
21022 Assert(
false, ExcInvalidHMatrixType(type));
21030template <
int spacedim,
typename Number>
21034 if (bc_node->is_root())
21036 std::make_unique<HMatrixVmultSerialRecursive<spacedim, Number>>();
21040template <
int spacedim,
typename Number>
21045 if (bc_node->is_root())
21046 vmult_strategy = std::move(strategy);
21050template <
int spacedim,
typename Number>
21054 const Vector<Number> &x,
21057 vmult(y, real_type(1.0), x, top_hmat_property);
21061template <
int spacedim,
typename Number>
21062template <
typename Number2>
21066 const Number2 alpha,
21067 const Vector<Number> &x,
21070 static_assert(is_number_larger_or_equal<Number, Number2>());
21078 for (
HMatrix *submatrix : submatrices)
21080 submatrix->vmult(y, alpha, x, top_hmat_property);
21090 switch (top_hmat_property)
21092 case HMatrixSupport::Property::general: {
21097 Assert(property == HMatrixSupport::Property::general,
21098 ExcInvalidHMatrixProperty(property));
21099 Assert(fullmatrix->get_property() ==
21100 LAPACKSupport::Property::general,
21101 ExcInvalidLAPACKFullMatrixProperty(
21102 fullmatrix->get_property()));
21104 Vector<Number> local_y(m);
21105 Vector<Number> local_x(n);
21112 local_x(j) = x((*col_index_range)[0] + j);
21115 fullmatrix->vmult(local_y, local_x);
21122 y((*row_index_range)[0] + i) += local_y(i) * alpha;
21127 case HMatrixSupport::Property::symmetric: {
21132 switch (block_type)
21134 case HMatrixSupport::BlockType::diagonal_block: {
21141 HMatrixSupport::Property::symmetric,
21142 ExcInvalidHMatrixProperty(property));
21147 Assert(fullmatrix->get_property() ==
21148 LAPACKSupport::Property::symmetric,
21149 ExcInvalidLAPACKFullMatrixProperty(
21150 fullmatrix->get_property()));
21159 Vector<Number> local_y(m);
21160 Vector<Number> local_x(n);
21167 local_x(j) = x((*col_index_range)[0] + j);
21170 fullmatrix->vmult(local_y, local_x);
21177 y((*row_index_range)[0] + i) +=
21178 alpha * local_y(i);
21183 case HMatrixSupport::BlockType::
21184 lower_triangular_block: {
21199 Assert(property == HMatrixSupport::Property::general,
21200 ExcInvalidHMatrixProperty(property));
21201 Assert(fullmatrix->get_property() ==
21202 LAPACKSupport::Property::general,
21203 ExcInvalidLAPACKFullMatrixProperty(
21204 fullmatrix->get_property()));
21206 Vector<Number> local_y(m);
21207 Vector<Number> local_x(n);
21214 local_x(j) = x((*col_index_range)[0] + j);
21217 fullmatrix->vmult(local_y, local_x);
21224 y((*row_index_range)[0] + i) +=
21225 alpha * local_y(i);
21228 Vector<Number> local_y_for_Tvmult(n);
21229 Vector<Number> local_x_for_Tvmult(m);
21237 local_x_for_Tvmult(i) =
21238 x((*row_index_range)[0] + i);
21241 fullmatrix->Tvmult(local_y_for_Tvmult,
21242 local_x_for_Tvmult);
21250 y((*col_index_range)[0] + j) +=
21251 alpha * local_y_for_Tvmult(j);
21256 case HMatrixSupport::BlockType::
21257 upper_triangular_block: {
21265 Assert(
false, ExcInvalidHMatrixBlockType(block_type));
21273 case HMatrixSupport::Property::hermite_symmetric: {
21279 switch (block_type)
21281 case HMatrixSupport::BlockType::diagonal_block: {
21288 HMatrixSupport::Property::hermite_symmetric,
21289 ExcInvalidHMatrixProperty(property));
21294 Assert(fullmatrix->get_property() ==
21295 LAPACKSupport::Property::hermite_symmetric,
21296 ExcInvalidLAPACKFullMatrixProperty(
21297 fullmatrix->get_property()));
21306 Vector<Number> local_y(m);
21307 Vector<Number> local_x(n);
21314 local_x(j) = x((*col_index_range)[0] + j);
21317 fullmatrix->vmult(local_y, local_x);
21324 y((*row_index_range)[0] + i) +=
21325 alpha * local_y(i);
21330 case HMatrixSupport::BlockType::
21331 lower_triangular_block: {
21345 Assert(property == HMatrixSupport::Property::general,
21346 ExcInvalidHMatrixProperty(property));
21347 Assert(fullmatrix->get_property() ==
21348 LAPACKSupport::Property::general,
21349 ExcInvalidLAPACKFullMatrixProperty(
21350 fullmatrix->get_property()));
21352 Vector<Number> local_y(m);
21353 Vector<Number> local_x(n);
21360 local_x(j) = x((*col_index_range)[0] + j);
21363 fullmatrix->vmult(local_y, local_x);
21370 y((*row_index_range)[0] + i) +=
21371 alpha * local_y(i);
21374 Vector<Number> local_y_for_Hvmult(n);
21375 Vector<Number> local_x_for_Hvmult(m);
21383 local_x_for_Hvmult(i) =
21384 x((*row_index_range)[0] + i);
21387 fullmatrix->Hvmult(local_y_for_Hvmult,
21388 local_x_for_Hvmult);
21396 y((*col_index_range)[0] + j) +=
21397 alpha * local_y_for_Hvmult(j);
21402 case HMatrixSupport::BlockType::
21403 upper_triangular_block: {
21414 throw(ExcInvalidHMatrixBlockType(block_type));
21422 case HMatrixSupport::Property::lower_triangular: {
21428 switch (block_type)
21430 case HMatrixSupport::BlockType::diagonal_block: {
21437 HMatrixSupport::Property::lower_triangular,
21438 ExcInvalidHMatrixProperty(property));
21443 Assert(fullmatrix->get_property() ==
21444 LAPACKSupport::Property::lower_triangular,
21445 ExcInvalidLAPACKFullMatrixProperty(
21446 fullmatrix->get_property()));
21453 Vector<Number> local_y(m);
21454 Vector<Number> local_x(n);
21461 local_x(j) = x((*col_index_range)[0] + j);
21464 fullmatrix->vmult(local_y, local_x);
21471 y((*row_index_range)[0] + i) +=
21472 alpha * local_y(i);
21477 case HMatrixSupport::BlockType::
21478 lower_triangular_block: {
21485 Assert(property == HMatrixSupport::Property::general,
21486 ExcInvalidHMatrixProperty(property));
21487 Assert(fullmatrix->get_property() ==
21488 LAPACKSupport::Property::general,
21489 ExcInvalidLAPACKFullMatrixProperty(
21490 fullmatrix->get_property()));
21492 Vector<Number> local_y(m);
21493 Vector<Number> local_x(n);
21500 local_x(j) = x((*col_index_range)[0] + j);
21503 fullmatrix->vmult(local_y, local_x);
21510 y((*row_index_range)[0] + i) +=
21511 alpha * local_y(i);
21516 case HMatrixSupport::BlockType::
21517 upper_triangular_block: {
21526 throw(ExcInvalidHMatrixBlockType(block_type));
21534 case HMatrixSupport::Property::upper_triangular: {
21540 switch (block_type)
21542 case HMatrixSupport::BlockType::diagonal_block: {
21549 HMatrixSupport::Property::upper_triangular,
21550 ExcInvalidHMatrixProperty(property));
21555 Assert(fullmatrix->get_property() ==
21556 LAPACKSupport::Property::upper_triangular,
21557 ExcInvalidLAPACKFullMatrixProperty(
21558 fullmatrix->get_property()));
21564 Vector<Number> local_y(m);
21565 Vector<Number> local_x(n);
21572 local_x(j) = x((*col_index_range)[0] + j);
21575 fullmatrix->vmult(local_y, local_x);
21582 y((*row_index_range)[0] + i) +=
21583 alpha * local_y(i);
21588 case HMatrixSupport::BlockType::
21589 lower_triangular_block: {
21596 case HMatrixSupport::BlockType::
21597 upper_triangular_block: {
21604 Assert(property == HMatrixSupport::Property::general,
21605 ExcInvalidHMatrixProperty(property));
21606 Assert(fullmatrix->get_property() ==
21607 LAPACKSupport::Property::general,
21608 ExcInvalidLAPACKFullMatrixProperty(
21609 fullmatrix->get_property()));
21611 Vector<Number> local_y(m);
21612 Vector<Number> local_x(n);
21619 local_x(j) = x((*col_index_range)[0] + j);
21622 fullmatrix->vmult(local_y, local_x);
21629 y((*row_index_range)[0] + i) +=
21630 alpha * local_y(i);
21636 throw(ExcInvalidHMatrixBlockType(block_type));
21645 throw(ExcInvalidHMatrixProperty(top_hmat_property));
21658 switch (top_hmat_property)
21660 case HMatrixSupport::Property::general: {
21665 Assert(property == HMatrixSupport::Property::general,
21666 ExcInvalidHMatrixProperty(property));
21668 Vector<Number> local_y(m);
21669 Vector<Number> local_x(n);
21676 local_x(j) = x((*col_index_range)[0] + j);
21679 rkmatrix->vmult(local_y, local_x);
21686 y((*row_index_range)[0] + i) += alpha * local_y(i);
21691 case HMatrixSupport::Property::symmetric: {
21696 switch (block_type)
21698 case HMatrixSupport::BlockType::diagonal_block: {
21703 throw(ExcInvalidHMatrixBlockType(block_type));
21707 case HMatrixSupport::BlockType::
21708 lower_triangular_block: {
21723 Assert(property == HMatrixSupport::Property::general,
21724 ExcInvalidHMatrixProperty(property));
21726 Vector<Number> local_y(m);
21727 Vector<Number> local_x(n);
21734 local_x(j) = x((*col_index_range)[0] + j);
21737 rkmatrix->vmult(local_y, local_x);
21744 y((*row_index_range)[0] + i) +=
21745 alpha * local_y(i);
21748 Vector<Number> local_y_for_Tvmult(n);
21749 Vector<Number> local_x_for_Tvmult(m);
21757 local_x_for_Tvmult(i) =
21758 x((*row_index_range)[0] + i);
21761 rkmatrix->Tvmult(local_y_for_Tvmult,
21762 local_x_for_Tvmult);
21770 y((*col_index_range)[0] + j) +=
21771 alpha * local_y_for_Tvmult(j);
21776 case HMatrixSupport::BlockType::
21777 upper_triangular_block: {
21785 throw(ExcInvalidHMatrixBlockType(block_type));
21793 case HMatrixSupport::Property::hermite_symmetric: {
21799 switch (block_type)
21801 case HMatrixSupport::BlockType::diagonal_block: {
21806 throw(ExcInvalidHMatrixBlockType(block_type));
21810 case HMatrixSupport::BlockType::
21811 lower_triangular_block: {
21825 Assert(property == HMatrixSupport::Property::general,
21826 ExcInvalidHMatrixProperty(property));
21828 Vector<Number> local_y(m);
21829 Vector<Number> local_x(n);
21836 local_x(j) = x((*col_index_range)[0] + j);
21839 rkmatrix->vmult(local_y, local_x);
21846 y((*row_index_range)[0] + i) +=
21847 alpha * local_y(i);
21850 Vector<Number> local_y_for_Hvmult(n);
21851 Vector<Number> local_x_for_Hvmult(m);
21859 local_x_for_Hvmult(i) =
21860 x((*row_index_range)[0] + i);
21863 rkmatrix->Hvmult(local_y_for_Hvmult,
21864 local_x_for_Hvmult);
21872 y((*col_index_range)[0] + j) +=
21873 alpha * local_y_for_Hvmult(j);
21878 case HMatrixSupport::BlockType::
21879 upper_triangular_block: {
21887 throw(ExcInvalidHMatrixBlockType(block_type));
21895 case HMatrixSupport::Property::lower_triangular: {
21901 switch (block_type)
21903 case HMatrixSupport::BlockType::diagonal_block: {
21908 throw(ExcInvalidHMatrixBlockType(block_type));
21912 case HMatrixSupport::BlockType::
21913 lower_triangular_block: {
21920 Assert(property == HMatrixSupport::Property::general,
21921 ExcInvalidHMatrixProperty(property));
21923 Vector<Number> local_y(m);
21924 Vector<Number> local_x(n);
21931 local_x(j) = x((*col_index_range)[0] + j);
21934 rkmatrix->vmult(local_y, local_x);
21941 y((*row_index_range)[0] + i) +=
21942 alpha * local_y(i);
21947 case HMatrixSupport::BlockType::
21948 upper_triangular_block: {
21956 throw(ExcInvalidHMatrixBlockType(block_type));
21964 case HMatrixSupport::Property::upper_triangular: {
21970 switch (block_type)
21972 case HMatrixSupport::BlockType::diagonal_block: {
21977 throw(ExcInvalidHMatrixBlockType(block_type));
21981 case HMatrixSupport::BlockType::
21982 lower_triangular_block: {
21989 case HMatrixSupport::BlockType::
21990 upper_triangular_block: {
21997 Assert(property == HMatrixSupport::Property::general,
21998 ExcInvalidHMatrixProperty(property));
22000 Vector<Number> local_y(m);
22001 Vector<Number> local_x(n);
22008 local_x(j) = x((*col_index_range)[0] + j);
22011 rkmatrix->vmult(local_y, local_x);
22018 y((*row_index_range)[0] + i) +=
22019 alpha * local_y(i);
22025 throw(ExcInvalidHMatrixBlockType(block_type));
22034 throw(ExcInvalidHMatrixProperty(top_hmat_property));
22044 Assert(
false, ExcInvalidHMatrixType(type));
22051template <
int spacedim,
typename Number>
22055 const Vector<Number> &x,
22059 vmult(y, real_type(1.0), x, starting_hmat, top_hmat_property);
22063template <
int spacedim,
typename Number>
22064template <
typename Number2>
22068 const Number2 alpha,
22069 const Vector<Number> &x,
22073 static_assert(is_number_larger_or_equal<Number, Number2>());
22081 for (
HMatrix *submatrix : submatrices)
22083 submatrix->vmult(y, alpha, x, starting_hmat, top_hmat_property);
22093 switch (top_hmat_property)
22095 case HMatrixSupport::Property::general: {
22100 Assert(property == HMatrixSupport::Property::general,
22101 ExcInvalidHMatrixProperty(property));
22102 Assert(fullmatrix->get_property() ==
22103 LAPACKSupport::Property::general,
22104 ExcInvalidLAPACKFullMatrixProperty(
22105 fullmatrix->get_property()));
22107 Vector<Number> local_y(m);
22108 Vector<Number> local_x(n);
22115 local_x(j) = x((*col_index_range)[0] -
22119 fullmatrix->vmult(local_y, local_x);
22126 y((*row_index_range)[0] -
22128 alpha * local_y(i);
22133 case HMatrixSupport::Property::symmetric: {
22138 switch (block_type)
22140 case HMatrixSupport::BlockType::diagonal_block: {
22147 HMatrixSupport::Property::symmetric,
22148 ExcInvalidHMatrixProperty(property));
22153 Assert(fullmatrix->get_property() ==
22154 LAPACKSupport::Property::symmetric,
22155 ExcInvalidLAPACKFullMatrixProperty(
22156 fullmatrix->get_property()));
22165 Vector<Number> local_y(m);
22166 Vector<Number> local_x(n);
22174 x((*col_index_range)[0] -
22178 fullmatrix->vmult(local_y, local_x);
22185 y((*row_index_range)[0] -
22187 alpha * local_y(i);
22192 case HMatrixSupport::BlockType::
22193 lower_triangular_block: {
22208 Assert(property == HMatrixSupport::Property::general,
22209 ExcInvalidHMatrixProperty(property));
22210 Assert(fullmatrix->get_property() ==
22211 LAPACKSupport::Property::general,
22212 ExcInvalidLAPACKFullMatrixProperty(
22213 fullmatrix->get_property()));
22215 Vector<Number> local_y(m);
22216 Vector<Number> local_x(n);
22224 x((*col_index_range)[0] -
22228 fullmatrix->vmult(local_y, local_x);
22235 y((*row_index_range)[0] -
22237 alpha * local_y(i);
22240 Vector<Number> local_y_for_Tvmult(n);
22241 Vector<Number> local_x_for_Tvmult(m);
22249 local_x_for_Tvmult(i) =
22250 x((*row_index_range)[0] -
22254 fullmatrix->Tvmult(local_y_for_Tvmult,
22255 local_x_for_Tvmult);
22263 y((*col_index_range)[0] -
22265 alpha * local_y_for_Tvmult(j);
22270 case HMatrixSupport::BlockType::
22271 upper_triangular_block: {
22279 throw(ExcInvalidHMatrixBlockType(block_type));
22287 case HMatrixSupport::Property::hermite_symmetric: {
22293 switch (block_type)
22295 case HMatrixSupport::BlockType::diagonal_block: {
22302 HMatrixSupport::Property::hermite_symmetric,
22303 ExcInvalidHMatrixProperty(property));
22308 Assert(fullmatrix->get_property() ==
22309 LAPACKSupport::Property::hermite_symmetric,
22310 ExcInvalidLAPACKFullMatrixProperty(
22311 fullmatrix->get_property()));
22320 Vector<Number> local_y(m);
22321 Vector<Number> local_x(n);
22329 x((*col_index_range)[0] -
22333 fullmatrix->vmult(local_y, local_x);
22340 y((*row_index_range)[0] -
22342 alpha * local_y(i);
22347 case HMatrixSupport::BlockType::
22348 lower_triangular_block: {
22362 Assert(property == HMatrixSupport::Property::general,
22363 ExcInvalidHMatrixProperty(property));
22364 Assert(fullmatrix->get_property() ==
22365 LAPACKSupport::Property::general,
22366 ExcInvalidLAPACKFullMatrixProperty(
22367 fullmatrix->get_property()));
22369 Vector<Number> local_y(m);
22370 Vector<Number> local_x(n);
22378 x((*col_index_range)[0] -
22382 fullmatrix->vmult(local_y, local_x);
22389 y((*row_index_range)[0] -
22391 alpha * local_y(i);
22394 Vector<Number> local_y_for_Hvmult(n);
22395 Vector<Number> local_x_for_Hvmult(m);
22403 local_x_for_Hvmult(i) =
22404 x((*row_index_range)[0] -
22408 fullmatrix->Hvmult(local_y_for_Hvmult,
22409 local_x_for_Hvmult);
22417 y((*col_index_range)[0] -
22419 alpha * local_y_for_Hvmult(j);
22424 case HMatrixSupport::BlockType::
22425 upper_triangular_block: {
22433 throw(ExcInvalidHMatrixBlockType(block_type));
22441 case HMatrixSupport::Property::lower_triangular: {
22447 switch (block_type)
22449 case HMatrixSupport::BlockType::diagonal_block: {
22456 HMatrixSupport::Property::lower_triangular,
22457 ExcInvalidHMatrixProperty(property));
22462 Assert(fullmatrix->get_property() ==
22463 LAPACKSupport::Property::lower_triangular,
22464 ExcInvalidLAPACKFullMatrixProperty(
22465 fullmatrix->get_property()));
22472 Vector<Number> local_y(m);
22473 Vector<Number> local_x(n);
22481 x((*col_index_range)[0] -
22485 fullmatrix->vmult(local_y, local_x);
22492 y((*row_index_range)[0] -
22494 alpha * local_y(i);
22499 case HMatrixSupport::BlockType::
22500 lower_triangular_block: {
22507 Assert(property == HMatrixSupport::Property::general,
22508 ExcInvalidHMatrixProperty(property));
22509 Assert(fullmatrix->get_property() ==
22510 LAPACKSupport::Property::general,
22511 ExcInvalidLAPACKFullMatrixProperty(
22512 fullmatrix->get_property()));
22514 Vector<Number> local_y(m);
22515 Vector<Number> local_x(n);
22523 x((*col_index_range)[0] -
22527 fullmatrix->vmult(local_y, local_x);
22534 y((*row_index_range)[0] -
22536 alpha * local_y(i);
22541 case HMatrixSupport::BlockType::
22542 upper_triangular_block: {
22551 throw(ExcInvalidHMatrixBlockType(block_type));
22559 case HMatrixSupport::Property::upper_triangular: {
22565 switch (block_type)
22567 case HMatrixSupport::BlockType::diagonal_block: {
22574 HMatrixSupport::Property::upper_triangular,
22575 ExcInvalidHMatrixProperty(property));
22580 Assert(fullmatrix->get_property() ==
22581 LAPACKSupport::Property::upper_triangular,
22582 ExcInvalidLAPACKFullMatrixProperty(
22583 fullmatrix->get_property()));
22589 Vector<Number> local_y(m);
22590 Vector<Number> local_x(n);
22598 x((*col_index_range)[0] -
22602 fullmatrix->vmult(local_y, local_x);
22609 y((*row_index_range)[0] -
22611 alpha * local_y(i);
22616 case HMatrixSupport::BlockType::
22617 lower_triangular_block: {
22624 case HMatrixSupport::BlockType::
22625 upper_triangular_block: {
22632 Assert(property == HMatrixSupport::Property::general,
22633 ExcInvalidHMatrixProperty(property));
22634 Assert(fullmatrix->get_property() ==
22635 LAPACKSupport::Property::general,
22636 ExcInvalidLAPACKFullMatrixProperty(
22637 fullmatrix->get_property()));
22639 Vector<Number> local_y(m);
22640 Vector<Number> local_x(n);
22648 x((*col_index_range)[0] -
22652 fullmatrix->vmult(local_y, local_x);
22659 y((*row_index_range)[0] -
22661 alpha * local_y(i);
22667 throw(ExcInvalidHMatrixBlockType(block_type));
22676 throw(ExcInvalidHMatrixProperty(top_hmat_property));
22689 switch (top_hmat_property)
22691 case HMatrixSupport::Property::general: {
22696 Assert(property == HMatrixSupport::Property::general,
22697 ExcInvalidHMatrixProperty(property));
22699 Vector<Number> local_y(m);
22700 Vector<Number> local_x(n);
22707 local_x(j) = x((*col_index_range)[0] -
22711 rkmatrix->vmult(local_y, local_x);
22718 y((*row_index_range)[0] -
22720 alpha * local_y(i);
22725 case HMatrixSupport::Property::symmetric: {
22730 switch (block_type)
22732 case HMatrixSupport::BlockType::diagonal_block: {
22737 Assert(
false, ExcInvalidHMatrixBlockType(block_type));
22741 case HMatrixSupport::BlockType::
22742 lower_triangular_block: {
22757 Assert(property == HMatrixSupport::Property::general,
22758 ExcInvalidHMatrixProperty(property));
22760 Vector<Number> local_y(m);
22761 Vector<Number> local_x(n);
22769 x((*col_index_range)[0] -
22773 rkmatrix->vmult(local_y, local_x);
22780 y((*row_index_range)[0] -
22782 alpha * local_y(i);
22785 Vector<Number> local_y_for_Tvmult(n);
22786 Vector<Number> local_x_for_Tvmult(m);
22794 local_x_for_Tvmult(i) =
22795 x((*row_index_range)[0] -
22799 rkmatrix->Tvmult(local_y_for_Tvmult,
22800 local_x_for_Tvmult);
22808 y((*col_index_range)[0] -
22810 alpha * local_y_for_Tvmult(j);
22815 case HMatrixSupport::BlockType::
22816 upper_triangular_block: {
22824 throw(ExcInvalidHMatrixBlockType(block_type));
22832 case HMatrixSupport::Property::hermite_symmetric: {
22838 switch (block_type)
22840 case HMatrixSupport::BlockType::diagonal_block: {
22845 Assert(
false, ExcInvalidHMatrixBlockType(block_type));
22849 case HMatrixSupport::BlockType::
22850 lower_triangular_block: {
22864 Assert(property == HMatrixSupport::Property::general,
22865 ExcInvalidHMatrixProperty(property));
22867 Vector<Number> local_y(m);
22868 Vector<Number> local_x(n);
22876 x((*col_index_range)[0] -
22880 rkmatrix->vmult(local_y, local_x);
22887 y((*row_index_range)[0] -
22889 alpha * local_y(i);
22892 Vector<Number> local_y_for_Hvmult(n);
22893 Vector<Number> local_x_for_Hvmult(m);
22901 local_x_for_Hvmult(i) =
22902 x((*row_index_range)[0] -
22906 rkmatrix->Hvmult(local_y_for_Hvmult,
22907 local_x_for_Hvmult);
22915 y((*col_index_range)[0] -
22917 alpha * local_y_for_Hvmult(j);
22922 case HMatrixSupport::BlockType::
22923 upper_triangular_block: {
22931 throw(ExcInvalidHMatrixBlockType(block_type));
22939 case HMatrixSupport::Property::lower_triangular: {
22945 switch (block_type)
22947 case HMatrixSupport::BlockType::diagonal_block: {
22952 throw(ExcInvalidHMatrixBlockType(block_type));
22956 case HMatrixSupport::BlockType::
22957 lower_triangular_block: {
22964 Assert(property == HMatrixSupport::Property::general,
22965 ExcInvalidHMatrixProperty(property));
22967 Vector<Number> local_y(m);
22968 Vector<Number> local_x(n);
22976 x((*col_index_range)[0] -
22980 rkmatrix->vmult(local_y, local_x);
22987 y((*row_index_range)[0] -
22989 alpha * local_y(i);
22994 case HMatrixSupport::BlockType::
22995 upper_triangular_block: {
23003 throw(ExcInvalidHMatrixBlockType(block_type));
23011 case HMatrixSupport::Property::upper_triangular: {
23017 switch (block_type)
23019 case HMatrixSupport::BlockType::diagonal_block: {
23024 throw(ExcInvalidHMatrixBlockType(block_type));
23028 case HMatrixSupport::BlockType::
23029 lower_triangular_block: {
23036 case HMatrixSupport::BlockType::
23037 upper_triangular_block: {
23044 Assert(property == HMatrixSupport::Property::general,
23045 ExcInvalidHMatrixProperty(property));
23047 Vector<Number> local_y(m);
23048 Vector<Number> local_x(n);
23056 x((*col_index_range)[0] -
23060 rkmatrix->vmult(local_y, local_x);
23067 y((*row_index_range)[0] -
23069 alpha * local_y(i);
23075 throw(ExcInvalidHMatrixBlockType(block_type));
23084 throw(ExcInvalidHMatrixProperty(top_hmat_property));
23094 Assert(
false, ExcInvalidHMatrixType(type));
23101template <
int spacedim,
typename Number>
23102template <
typename Number2,
typename Number3>
23106 const Number3 alpha,
23107 const Vector<Number> &x)
const
23109 static_assert(is_number_larger_or_equal<Number, Number2>());
23110 static_assert(is_number_larger_or_equal<Number, Number3>());
23114 Assert(parent ==
nullptr, ExcInternalError());
23124 for (
size_type l = 0; l < leaf_set.size(); l++)
23126 const size_type m = this->leaf_set[l]->m;
23127 const size_type n = this->leaf_set[l]->n;
23133 Vector<Number> local_y(m);
23134 Vector<Number> local_x(n);
23141 local_x(j) = x((*this->leaf_set[l]->col_index_range)[0] + j);
23144 switch (this->leaf_set[l]->type)
23147 this->leaf_set[l]->fullmatrix->vmult(local_y, local_x);
23152 this->leaf_set[l]->rkmatrix->vmult(local_y, local_x);
23157 Assert(
false, ExcInvalidHMatrixType(this->leaf_set[l]->type));
23168 y((*this->leaf_set[l]->row_index_range)[0] + i) += alpha * local_y(i);
23171 if (this->property == HMatrixSupport::Property::symmetric &&
23172 this->leaf_set[l]->block_type ==
23173 HMatrixSupport::BlockType::lower_triangular_block)
23181 Vector<Number> local_y_for_Tvmult(n);
23182 Vector<Number> local_x_for_Tvmult(m);
23190 local_x_for_Tvmult(i) =
23191 x((*this->leaf_set[l]->row_index_range)[0] + i);
23194 switch (this->leaf_set[l]->type)
23197 this->leaf_set[l]->fullmatrix->Tvmult(local_y_for_Tvmult,
23198 local_x_for_Tvmult);
23203 this->leaf_set[l]->rkmatrix->Tvmult(local_y_for_Tvmult,
23204 local_x_for_Tvmult);
23209 Assert(
false, ExcInvalidHMatrixType(this->leaf_set[l]->type));
23221 y((*this->leaf_set[l]->col_index_range)[0] + j) +=
23222 alpha * local_y_for_Tvmult(j);
23225 else if (this->property == HMatrixSupport::Property::hermite_symmetric &&
23226 this->leaf_set[l]->block_type ==
23227 HMatrixSupport::BlockType::lower_triangular_block)
23235 Vector<Number> local_y_for_Hvmult(n);
23236 Vector<Number> local_x_for_Hvmult(m);
23244 local_x_for_Hvmult(i) =
23245 x((*this->leaf_set[l]->row_index_range)[0] + i);
23248 switch (this->leaf_set[l]->type)
23251 this->leaf_set[l]->fullmatrix->Hvmult(local_y_for_Hvmult,
23252 local_x_for_Hvmult);
23257 this->leaf_set[l]->rkmatrix->Hvmult(local_y_for_Hvmult,
23258 local_x_for_Hvmult);
23263 Assert(
false, ExcInvalidHMatrixType(this->leaf_set[l]->type));
23275 y((*this->leaf_set[l]->col_index_range)[0] + j) +=
23276 alpha * local_y_for_Hvmult(j);
23283template <
int spacedim,
typename Number>
23284template <
typename Number2,
typename Number3>
23288 const Number3 alpha,
23289 const Vector<Number> &x)
const
23291 static_assert(is_number_larger_or_equal<Number, Number2>());
23292 static_assert(is_number_larger_or_equal<Number, Number3>());
23296 Assert(parent ==
nullptr, ExcInternalError());
23298 const unsigned int thread_num = data_for_vmult_or_tvmult_threads->size();
23304 if (thread_num > 1)
23307 const int blas_num_threads = openblas_get_num_threads();
23308 openblas_set_num_threads(1);
23315 auto local_scale_and_multiplication =
23316 [
this, beta, alpha, &y, &x](
const unsigned int thread_no) ->
void {
23320 for (
size_type i = (*this->data_for_vmult_or_tvmult_threads)[thread_no]
23321 .vmult_result_index_range[0];
23322 i < (*this->data_for_vmult_or_tvmult_threads)[thread_no]
23323 .vmult_result_index_range[1];
23332 (*this->data_for_vmult_or_tvmult_threads)[thread_no]
23333 .local_vmult_result = Number(0.);
23334 if (this->property == HMatrixSupport::Property::symmetric ||
23335 this->property == HMatrixSupport::Property::hermite_symmetric)
23336 (*this->data_for_vmult_or_tvmult_threads)[thread_no]
23337 .local_tvmult_result = Number(0.);
23343 for (
size_type l = (*this->data_for_vmult_or_tvmult_threads)[thread_no]
23344 .leaf_set_interval.first;
23345 l <= (*this->data_for_vmult_or_tvmult_threads)[thread_no]
23346 .leaf_set_interval.second;
23349 const size_type m = this->leaf_set[l]->m;
23350 const size_type n = this->leaf_set[l]->n;
23356 Vector<Number> local_y(m);
23357 Vector<Number> local_x(n);
23364 local_x(j) = x((*this->leaf_set[l]->col_index_range)[0] + j);
23367 switch (this->leaf_set[l]->type)
23370 this->leaf_set[l]->fullmatrix->vmult(local_y, local_x);
23375 this->leaf_set[l]->rkmatrix->vmult(local_y, local_x);
23381 ExcInvalidHMatrixType(this->leaf_set[l]->type));
23394 (*this->data_for_vmult_or_tvmult_threads)[thread_no]
23395 .local_vmult_result(
23396 (*this->leaf_set[l]->row_index_range)[0] -
23397 (*this->data_for_vmult_or_tvmult_threads)[thread_no]
23398 .local_vmult_result_index_range[0] +
23399 i) += alpha * local_y(i);
23402 if (this->property == HMatrixSupport::Property::symmetric &&
23403 this->leaf_set[l]->block_type ==
23404 HMatrixSupport::BlockType::lower_triangular_block)
23412 Vector<Number> local_y_for_Tvmult(n);
23413 Vector<Number> local_x_for_Tvmult(m);
23420 local_x_for_Tvmult(i) =
23421 x((*this->leaf_set[l]->row_index_range)[0] + i);
23424 switch (this->leaf_set[l]->type)
23427 this->leaf_set[l]->fullmatrix->Tvmult(
23428 local_y_for_Tvmult, local_x_for_Tvmult);
23433 this->leaf_set[l]->rkmatrix->Tvmult(local_y_for_Tvmult,
23434 local_x_for_Tvmult);
23440 ExcInvalidHMatrixType(this->leaf_set[l]->type));
23453 (*this->data_for_vmult_or_tvmult_threads)[thread_no]
23454 .local_tvmult_result(
23455 (*this->leaf_set[l]->col_index_range)[0] -
23456 (*this->data_for_vmult_or_tvmult_threads)[thread_no]
23457 .local_tvmult_result_index_range[0] +
23458 j) += alpha * local_y_for_Tvmult(j);
23461 else if (this->property ==
23462 HMatrixSupport::Property::hermite_symmetric &&
23463 this->leaf_set[l]->block_type ==
23464 HMatrixSupport::BlockType::lower_triangular_block)
23472 Vector<Number> local_y_for_Hvmult(n);
23473 Vector<Number> local_x_for_Hvmult(m);
23480 local_x_for_Hvmult(i) =
23481 x((*this->leaf_set[l]->row_index_range)[0] + i);
23484 switch (this->leaf_set[l]->type)
23487 this->leaf_set[l]->fullmatrix->Hvmult(
23488 local_y_for_Hvmult, local_x_for_Hvmult);
23493 this->leaf_set[l]->rkmatrix->Hvmult(local_y_for_Hvmult,
23494 local_x_for_Hvmult);
23500 ExcInvalidHMatrixType(this->leaf_set[l]->type));
23513 (*this->data_for_vmult_or_tvmult_threads)[thread_no]
23514 .local_tvmult_result(
23515 (*this->leaf_set[l]->col_index_range)[0] -
23516 (*this->data_for_vmult_or_tvmult_threads)[thread_no]
23517 .local_tvmult_result_index_range[0] +
23518 j) += alpha * local_y_for_Hvmult(j);
23524 Threads::TaskGroup<void> local_scaling_and_multiplication_tasks;
23525 for (
unsigned int i = 0; i < thread_num; i++)
23527 local_scaling_and_multiplication_tasks +=
23528 Threads::new_task(std::bind(local_scale_and_multiplication, i));
23531 local_scaling_and_multiplication_tasks.join_all();
23533 auto assemble_contribution_from_all_threads =
23534 [
this, &y](
const unsigned int thread_no) ->
void {
23535 unsigned int other_thread_no = 0;
23536 for (
const auto &range_intersection :
23537 (*this->data_for_vmult_or_tvmult_threads)[thread_no]
23538 .vmult_result_index_ranges_contributed_from_other_threads)
23540 for (
size_type i = range_intersection[0]; i < range_intersection[1];
23544 (*this->data_for_vmult_or_tvmult_threads)[other_thread_no]
23545 .local_vmult_result(
23547 (*this->data_for_vmult_or_tvmult_threads)[other_thread_no]
23548 .local_vmult_result_index_range[0]);
23554 if (this->property == HMatrixSupport::Property::symmetric ||
23555 this->property == HMatrixSupport::Property::hermite_symmetric)
23562 unsigned int other_thread_no = 0;
23563 for (
const auto &range_intersection :
23564 (*this->data_for_vmult_or_tvmult_threads)[thread_no]
23565 .tvmult_result_index_ranges_contributed_from_other_threads)
23567 for (
size_type i = range_intersection[0];
23568 i < range_intersection[1];
23572 (*this->data_for_vmult_or_tvmult_threads)[other_thread_no]
23573 .local_tvmult_result(
23574 i - (*this->data_for_vmult_or_tvmult_threads)
23576 .local_tvmult_result_index_range[0]);
23584 Threads::TaskGroup<void> assembly_tasks;
23585 for (
unsigned int i = 0; i < thread_num; i++)
23587 assembly_tasks += Threads::new_task(
23588 std::bind(assemble_contribution_from_all_threads, i));
23591 assembly_tasks.join_all();
23594 openblas_set_num_threads(blas_num_threads);
23598 vmult_serial_iterative(beta, y, alpha, x);
23603template <
int spacedim,
typename Number>
23606 const Vector<Number> &x)
const
23608 if (!vmult_strategy)
23610 Assert(
false, ExcInternalError());
23613 vmult_strategy->vmult(y, *
this, x);
23617template <
int spacedim,
typename Number>
23620 const Vector<Number> &x)
const
23622 if (!vmult_strategy)
23624 Assert(
false, ExcInternalError());
23627 vmult_strategy->vmult_add(y, *
this, x);
23631template <
int spacedim,
typename Number>
23632template <
typename Number2>
23635 const Number2 alpha,
23636 const Vector<Number> &x)
const
23638 if (!vmult_strategy)
23640 Assert(
false, ExcInternalError());
23643 vmult_strategy->vmult(y, alpha, *
this, x);
23647template <
int spacedim,
typename Number>
23648template <
typename Number2>
23651 const Number2 alpha,
23652 const Vector<Number> &x)
const
23654 if (!vmult_strategy)
23656 Assert(
false, ExcInternalError());
23659 vmult_strategy->vmult_add(y, alpha, *
this, x);
23663template <
int spacedim,
typename Number>
23667 const Vector<Number> &x,
23670 Tvmult(y, real_type(1.0), x, top_hmat_property);
23674template <
int spacedim,
typename Number>
23675template <
typename Number2>
23679 const Number2 alpha,
23680 const Vector<Number> &x,
23683 static_assert(is_number_larger_or_equal<Number, Number2>());
23691 for (
HMatrix *submatrix : submatrices)
23693 submatrix->Tvmult(y, alpha, x, top_hmat_property);
23703 switch (top_hmat_property)
23705 case HMatrixSupport::Property::general: {
23710 Assert(property == HMatrixSupport::Property::general,
23711 ExcInvalidHMatrixProperty(property));
23712 Assert(fullmatrix->get_property() ==
23713 LAPACKSupport::Property::general,
23714 ExcInvalidLAPACKFullMatrixProperty(
23715 fullmatrix->get_property()));
23717 Vector<Number> local_y(n);
23718 Vector<Number> local_x(m);
23725 local_x(j) = x((*row_index_range)[0] + j);
23728 fullmatrix->Tvmult(local_y, local_x);
23735 y((*col_index_range)[0] + i) += alpha * local_y(i);
23740 case HMatrixSupport::Property::symmetric: {
23745 switch (block_type)
23747 case HMatrixSupport::BlockType::diagonal_block: {
23754 HMatrixSupport::Property::symmetric,
23755 ExcInvalidHMatrixProperty(property));
23760 Assert(fullmatrix->get_property() ==
23761 LAPACKSupport::Property::symmetric,
23762 ExcInvalidLAPACKFullMatrixProperty(
23763 fullmatrix->get_property()));
23772 Vector<Number> local_y(n);
23773 Vector<Number> local_x(m);
23780 local_x(j) = x((*row_index_range)[0] + j);
23783 fullmatrix->Tvmult(local_y, local_x);
23790 y((*col_index_range)[0] + i) +=
23791 alpha * local_y(i);
23796 case HMatrixSupport::BlockType::
23797 lower_triangular_block: {
23810 Assert(property == HMatrixSupport::Property::general,
23811 ExcInvalidHMatrixProperty(property));
23812 Assert(fullmatrix->get_property() ==
23813 LAPACKSupport::Property::general,
23814 ExcInvalidLAPACKFullMatrixProperty(
23815 fullmatrix->get_property()));
23817 Vector<Number> local_y(n);
23818 Vector<Number> local_x(m);
23825 local_x(j) = x((*row_index_range)[0] + j);
23828 fullmatrix->Tvmult(local_y, local_x);
23835 y((*col_index_range)[0] + i) +=
23836 alpha * local_y(i);
23839 Vector<Number> local_y_for_vmult(m);
23840 Vector<Number> local_x_for_vmult(n);
23847 local_x_for_vmult(j) =
23848 x((*col_index_range)[0] + j);
23851 fullmatrix->vmult(local_y_for_vmult,
23852 local_x_for_vmult);
23859 y((*row_index_range)[0] + i) +=
23860 alpha * local_y_for_vmult(i);
23865 case HMatrixSupport::BlockType::
23866 upper_triangular_block: {
23877 throw(ExcInvalidHMatrixBlockType(block_type));
23885 case HMatrixSupport::Property::hermite_symmetric: {
23891 switch (block_type)
23893 case HMatrixSupport::BlockType::diagonal_block: {
23900 HMatrixSupport::Property::hermite_symmetric,
23901 ExcInvalidHMatrixProperty(property));
23906 Assert(fullmatrix->get_property() ==
23907 LAPACKSupport::Property::hermite_symmetric,
23908 ExcInvalidLAPACKFullMatrixProperty(
23909 fullmatrix->get_property()));
23918 Vector<Number> local_y(n);
23919 Vector<Number> local_x(m);
23926 local_x(j) = x((*row_index_range)[0] + j);
23929 fullmatrix->Tvmult(local_y, local_x);
23936 y((*col_index_range)[0] + i) +=
23937 alpha * local_y(i);
23942 case HMatrixSupport::BlockType::
23943 lower_triangular_block: {
23957 Assert(property == HMatrixSupport::Property::general,
23958 ExcInvalidHMatrixProperty(property));
23959 Assert(fullmatrix->get_property() ==
23960 LAPACKSupport::Property::general,
23961 ExcInvalidLAPACKFullMatrixProperty(
23962 fullmatrix->get_property()));
23964 Vector<Number> local_y(n);
23965 Vector<Number> local_x(m);
23972 local_x(j) = x((*row_index_range)[0] + j);
23975 fullmatrix->Tvmult(local_y, local_x);
23982 y((*col_index_range)[0] + i) +=
23983 alpha * local_y(i);
23986 Vector<Number> local_y_for_vmult(m);
23987 Vector<Number> local_x_for_vmult(n);
23994 local_x_for_vmult(j) =
23995 x((*col_index_range)[0] + j);
23998 fullmatrix->Cvmult(local_y_for_vmult,
23999 local_x_for_vmult);
24006 y((*row_index_range)[0] + i) +=
24007 alpha * local_y_for_vmult(i);
24012 case HMatrixSupport::BlockType::
24013 upper_triangular_block: {
24024 throw(ExcInvalidHMatrixBlockType(block_type));
24032 case HMatrixSupport::Property::lower_triangular: {
24038 switch (block_type)
24040 case HMatrixSupport::BlockType::diagonal_block: {
24047 HMatrixSupport::Property::lower_triangular,
24048 ExcInvalidHMatrixProperty(property));
24053 Assert(fullmatrix->get_property() ==
24054 LAPACKSupport::Property::lower_triangular,
24055 ExcInvalidLAPACKFullMatrixProperty(
24056 fullmatrix->get_property()));
24062 Vector<Number> local_y(n);
24063 Vector<Number> local_x(m);
24070 local_x(j) = x((*row_index_range)[0] + j);
24073 fullmatrix->Tvmult(local_y, local_x);
24080 y((*col_index_range)[0] + i) +=
24081 alpha * local_y(i);
24086 case HMatrixSupport::BlockType::
24087 lower_triangular_block: {
24093 Assert(property == HMatrixSupport::Property::general,
24094 ExcInvalidHMatrixProperty(property));
24095 Assert(fullmatrix->get_property() ==
24096 LAPACKSupport::Property::general,
24097 ExcInvalidLAPACKFullMatrixProperty(
24098 fullmatrix->get_property()));
24100 Vector<Number> local_y(n);
24101 Vector<Number> local_x(m);
24108 local_x(j) = x((*row_index_range)[0] + j);
24111 fullmatrix->Tvmult(local_y, local_x);
24118 y((*col_index_range)[0] + i) +=
24119 alpha * local_y(i);
24124 case HMatrixSupport::BlockType::
24125 upper_triangular_block: {
24135 throw(ExcInvalidHMatrixBlockType(block_type));
24143 case HMatrixSupport::Property::upper_triangular: {
24149 switch (block_type)
24151 case HMatrixSupport::BlockType::diagonal_block: {
24158 HMatrixSupport::Property::upper_triangular,
24159 ExcInvalidHMatrixProperty(property));
24164 Assert(fullmatrix->get_property() ==
24165 LAPACKSupport::Property::upper_triangular,
24166 ExcInvalidLAPACKFullMatrixProperty(
24167 fullmatrix->get_property()));
24173 Vector<Number> local_y(n);
24174 Vector<Number> local_x(m);
24181 local_x(j) = x((*row_index_range)[0] + j);
24184 fullmatrix->Tvmult(local_y, local_x);
24191 y((*col_index_range)[0] + i) +=
24192 alpha * local_y(i);
24197 case HMatrixSupport::BlockType::
24198 upper_triangular_block: {
24204 Assert(property == HMatrixSupport::Property::general,
24205 ExcInvalidHMatrixProperty(property));
24206 Assert(fullmatrix->get_property() ==
24207 LAPACKSupport::Property::general,
24208 ExcInvalidLAPACKFullMatrixProperty(
24209 fullmatrix->get_property()));
24211 Vector<Number> local_y(n);
24212 Vector<Number> local_x(m);
24219 local_x(j) = x((*row_index_range)[0] + j);
24222 fullmatrix->Tvmult(local_y, local_x);
24229 y((*col_index_range)[0] + i) +=
24230 alpha * local_y(i);
24235 case HMatrixSupport::BlockType::
24236 lower_triangular_block: {
24244 throw(ExcInvalidHMatrixBlockType(block_type));
24253 throw(ExcInvalidHMatrixProperty(top_hmat_property));
24266 switch (top_hmat_property)
24268 case HMatrixSupport::Property::general: {
24273 Assert(property == HMatrixSupport::Property::general,
24274 ExcInvalidHMatrixProperty(property));
24276 Vector<Number> local_y(n);
24277 Vector<Number> local_x(m);
24284 local_x(j) = x((*row_index_range)[0] + j);
24287 rkmatrix->Tvmult(local_y, local_x);
24294 y((*col_index_range)[0] + i) += alpha * local_y(i);
24299 case HMatrixSupport::Property::symmetric: {
24304 switch (block_type)
24306 case HMatrixSupport::BlockType::diagonal_block: {
24311 throw(ExcInvalidHMatrixBlockType(block_type));
24315 case HMatrixSupport::BlockType::
24316 lower_triangular_block: {
24329 Assert(property == HMatrixSupport::Property::general,
24330 ExcInvalidHMatrixProperty(property));
24332 Vector<Number> local_y(n);
24333 Vector<Number> local_x(m);
24340 local_x(j) = x((*row_index_range)[0] + j);
24343 rkmatrix->Tvmult(local_y, local_x);
24350 y((*col_index_range)[0] + i) +=
24351 alpha * local_y(i);
24354 Vector<Number> local_y_for_vmult(m);
24355 Vector<Number> local_x_for_vmult(n);
24362 local_x_for_vmult(j) =
24363 x((*col_index_range)[0] + j);
24366 rkmatrix->vmult(local_y_for_vmult, local_x_for_vmult);
24373 y((*row_index_range)[0] + i) +=
24374 alpha * local_y_for_vmult(i);
24379 case HMatrixSupport::BlockType::
24380 upper_triangular_block: {
24388 throw(ExcInvalidHMatrixBlockType(block_type));
24396 case HMatrixSupport::Property::hermite_symmetric: {
24402 switch (block_type)
24404 case HMatrixSupport::BlockType::diagonal_block: {
24409 throw(ExcInvalidHMatrixBlockType(block_type));
24413 case HMatrixSupport::BlockType::
24414 lower_triangular_block: {
24427 Assert(property == HMatrixSupport::Property::general,
24428 ExcInvalidHMatrixProperty(property));
24430 Vector<Number> local_y(n);
24431 Vector<Number> local_x(m);
24438 local_x(j) = x((*row_index_range)[0] + j);
24441 rkmatrix->Tvmult(local_y, local_x);
24448 y((*col_index_range)[0] + i) +=
24449 alpha * local_y(i);
24452 Vector<Number> local_y_for_vmult(m);
24453 Vector<Number> local_x_for_vmult(n);
24460 local_x_for_vmult(j) =
24461 x((*col_index_range)[0] + j);
24464 rkmatrix->Cvmult(local_y_for_vmult,
24465 local_x_for_vmult);
24472 y((*row_index_range)[0] + i) +=
24473 alpha * local_y_for_vmult(i);
24478 case HMatrixSupport::BlockType::
24479 upper_triangular_block: {
24487 throw(ExcInvalidHMatrixBlockType(block_type));
24495 case HMatrixSupport::Property::lower_triangular: {
24501 switch (block_type)
24503 case HMatrixSupport::BlockType::diagonal_block: {
24508 throw(ExcInvalidHMatrixBlockType(block_type));
24512 case HMatrixSupport::BlockType::
24513 lower_triangular_block: {
24519 Assert(property == HMatrixSupport::Property::general,
24520 ExcInvalidHMatrixProperty(property));
24522 Vector<Number> local_y(n);
24523 Vector<Number> local_x(m);
24530 local_x(j) = x((*row_index_range)[0] + j);
24533 rkmatrix->Tvmult(local_y, local_x);
24540 y((*col_index_range)[0] + i) +=
24541 alpha * local_y(i);
24546 case HMatrixSupport::BlockType::
24547 upper_triangular_block: {
24555 throw(ExcInvalidHMatrixBlockType(block_type));
24563 case HMatrixSupport::Property::upper_triangular: {
24569 switch (block_type)
24571 case HMatrixSupport::BlockType::diagonal_block: {
24576 throw(ExcInvalidHMatrixBlockType(block_type));
24580 case HMatrixSupport::BlockType::
24581 upper_triangular_block: {
24587 Assert(property == HMatrixSupport::Property::general,
24588 ExcInvalidHMatrixProperty(property));
24590 Vector<Number> local_y(n);
24591 Vector<Number> local_x(m);
24598 local_x(j) = x((*row_index_range)[0] + j);
24601 rkmatrix->Tvmult(local_y, local_x);
24608 y((*col_index_range)[0] + i) +=
24609 alpha * local_y(i);
24614 case HMatrixSupport::BlockType::
24615 lower_triangular_block: {
24623 throw(ExcInvalidHMatrixBlockType(block_type));
24632 throw(ExcInvalidHMatrixProperty(top_hmat_property));
24642 Assert(
false, ExcInvalidHMatrixType(type));
24649template <
int spacedim,
typename Number>
24653 const Vector<Number> &x,
24657 Tvmult(y, real_type(1.0), x, starting_hmat, top_hmat_property);
24661template <
int spacedim,
typename Number>
24662template <
typename Number2>
24666 const Number2 alpha,
24667 const Vector<Number> &x,
24671 static_assert(is_number_larger_or_equal<Number, Number2>());
24679 for (
HMatrix *submatrix : submatrices)
24681 submatrix->Tvmult(y, alpha, x, starting_hmat, top_hmat_property);
24691 switch (top_hmat_property)
24693 case HMatrixSupport::Property::general: {
24698 Assert(property == HMatrixSupport::Property::general,
24699 ExcInvalidHMatrixProperty(property));
24700 Assert(fullmatrix->get_property() ==
24701 LAPACKSupport::Property::general,
24702 ExcInvalidLAPACKFullMatrixProperty(
24703 fullmatrix->get_property()));
24705 Vector<Number> local_y(n);
24706 Vector<Number> local_x(m);
24713 local_x(j) = x((*row_index_range)[0] -
24717 fullmatrix->Tvmult(local_y, local_x);
24724 y((*col_index_range)[0] -
24726 alpha * local_y(i);
24731 case HMatrixSupport::Property::symmetric: {
24736 switch (block_type)
24738 case HMatrixSupport::BlockType::diagonal_block: {
24745 HMatrixSupport::Property::symmetric,
24746 ExcInvalidHMatrixProperty(property));
24751 Assert(fullmatrix->get_property() ==
24752 LAPACKSupport::Property::symmetric,
24753 ExcInvalidLAPACKFullMatrixProperty(
24754 fullmatrix->get_property()));
24763 Vector<Number> local_y(n);
24764 Vector<Number> local_x(m);
24772 x((*row_index_range)[0] -
24776 fullmatrix->Tvmult(local_y, local_x);
24783 y((*col_index_range)[0] -
24785 alpha * local_y(i);
24790 case HMatrixSupport::BlockType::
24791 lower_triangular_block: {
24804 Assert(property == HMatrixSupport::Property::general,
24805 ExcInvalidHMatrixProperty(property));
24806 Assert(fullmatrix->get_property() ==
24807 LAPACKSupport::Property::general,
24808 ExcInvalidLAPACKFullMatrixProperty(
24809 fullmatrix->get_property()));
24811 Vector<Number> local_y(n);
24812 Vector<Number> local_x(m);
24820 x((*row_index_range)[0] -
24824 fullmatrix->Tvmult(local_y, local_x);
24831 y((*col_index_range)[0] -
24833 alpha * local_y(i);
24836 Vector<Number> local_y_for_vmult(m);
24837 Vector<Number> local_x_for_vmult(n);
24844 local_x_for_vmult(j) =
24845 x((*col_index_range)[0] -
24849 fullmatrix->vmult(local_y_for_vmult,
24850 local_x_for_vmult);
24857 y((*row_index_range)[0] -
24859 alpha * local_y_for_vmult(i);
24864 case HMatrixSupport::BlockType::
24865 upper_triangular_block: {
24876 throw(ExcInvalidHMatrixBlockType(block_type));
24884 case HMatrixSupport::Property::hermite_symmetric: {
24890 switch (block_type)
24892 case HMatrixSupport::BlockType::diagonal_block: {
24899 HMatrixSupport::Property::hermite_symmetric,
24900 ExcInvalidHMatrixProperty(property));
24905 Assert(fullmatrix->get_property() ==
24906 LAPACKSupport::Property::hermite_symmetric,
24907 ExcInvalidLAPACKFullMatrixProperty(
24908 fullmatrix->get_property()));
24917 Vector<Number> local_y(n);
24918 Vector<Number> local_x(m);
24926 x((*row_index_range)[0] -
24930 fullmatrix->Tvmult(local_y, local_x);
24937 y((*col_index_range)[0] -
24939 alpha * local_y(i);
24944 case HMatrixSupport::BlockType::
24945 lower_triangular_block: {
24958 Assert(property == HMatrixSupport::Property::general,
24959 ExcInvalidHMatrixProperty(property));
24960 Assert(fullmatrix->get_property() ==
24961 LAPACKSupport::Property::general,
24962 ExcInvalidLAPACKFullMatrixProperty(
24963 fullmatrix->get_property()));
24965 Vector<Number> local_y(n);
24966 Vector<Number> local_x(m);
24974 x((*row_index_range)[0] -
24978 fullmatrix->Tvmult(local_y, local_x);
24985 y((*col_index_range)[0] -
24987 alpha * local_y(i);
24990 Vector<Number> local_y_for_vmult(m);
24991 Vector<Number> local_x_for_vmult(n);
24998 local_x_for_vmult(j) =
24999 x((*col_index_range)[0] -
25003 fullmatrix->Cvmult(local_y_for_vmult,
25004 local_x_for_vmult);
25011 y((*row_index_range)[0] -
25013 alpha * local_y_for_vmult(i);
25018 case HMatrixSupport::BlockType::
25019 upper_triangular_block: {
25030 throw(ExcInvalidHMatrixBlockType(block_type));
25038 case HMatrixSupport::Property::lower_triangular: {
25044 switch (block_type)
25046 case HMatrixSupport::BlockType::diagonal_block: {
25053 HMatrixSupport::Property::lower_triangular,
25054 ExcInvalidHMatrixProperty(property));
25059 Assert(fullmatrix->get_property() ==
25060 LAPACKSupport::Property::lower_triangular,
25061 ExcInvalidLAPACKFullMatrixProperty(
25062 fullmatrix->get_property()));
25068 Vector<Number> local_y(n);
25069 Vector<Number> local_x(m);
25077 x((*row_index_range)[0] -
25081 fullmatrix->Tvmult(local_y, local_x);
25088 y((*col_index_range)[0] -
25090 alpha * local_y(i);
25095 case HMatrixSupport::BlockType::
25096 lower_triangular_block: {
25102 Assert(property == HMatrixSupport::Property::general,
25103 ExcInvalidHMatrixProperty(property));
25104 Assert(fullmatrix->get_property() ==
25105 LAPACKSupport::Property::general,
25106 ExcInvalidLAPACKFullMatrixProperty(
25107 fullmatrix->get_property()));
25109 Vector<Number> local_y(n);
25110 Vector<Number> local_x(m);
25118 x((*row_index_range)[0] -
25122 fullmatrix->Tvmult(local_y, local_x);
25129 y((*col_index_range)[0] -
25131 alpha * local_y(i);
25136 case HMatrixSupport::BlockType::
25137 upper_triangular_block: {
25147 throw(ExcInvalidHMatrixBlockType(block_type));
25155 case HMatrixSupport::Property::upper_triangular: {
25161 switch (block_type)
25163 case HMatrixSupport::BlockType::diagonal_block: {
25170 HMatrixSupport::Property::upper_triangular,
25171 ExcInvalidHMatrixProperty(property));
25176 Assert(fullmatrix->get_property() ==
25177 LAPACKSupport::Property::upper_triangular,
25178 ExcInvalidLAPACKFullMatrixProperty(
25179 fullmatrix->get_property()));
25185 Vector<Number> local_y(n);
25186 Vector<Number> local_x(m);
25194 x((*row_index_range)[0] -
25198 fullmatrix->Tvmult(local_y, local_x);
25205 y((*col_index_range)[0] -
25207 alpha * local_y(i);
25212 case HMatrixSupport::BlockType::
25213 upper_triangular_block: {
25219 Assert(property == HMatrixSupport::Property::general,
25220 ExcInvalidHMatrixProperty(property));
25221 Assert(fullmatrix->get_property() ==
25222 LAPACKSupport::Property::general,
25223 ExcInvalidLAPACKFullMatrixProperty(
25224 fullmatrix->get_property()));
25226 Vector<Number> local_y(n);
25227 Vector<Number> local_x(m);
25235 x((*row_index_range)[0] -
25239 fullmatrix->Tvmult(local_y, local_x);
25246 y((*col_index_range)[0] -
25248 alpha * local_y(i);
25253 case HMatrixSupport::BlockType::
25254 lower_triangular_block: {
25262 throw(ExcInvalidHMatrixBlockType(block_type));
25271 throw(ExcInvalidHMatrixProperty(top_hmat_property));
25284 switch (top_hmat_property)
25286 case HMatrixSupport::Property::general: {
25291 Assert(property == HMatrixSupport::Property::general,
25292 ExcInvalidHMatrixProperty(property));
25294 Vector<Number> local_y(n);
25295 Vector<Number> local_x(m);
25302 local_x(j) = x((*row_index_range)[0] -
25306 rkmatrix->Tvmult(local_y, local_x);
25313 y((*col_index_range)[0] -
25315 alpha * local_y(i);
25320 case HMatrixSupport::Property::symmetric: {
25325 switch (block_type)
25327 case HMatrixSupport::BlockType::diagonal_block: {
25332 throw(ExcInvalidHMatrixBlockType(block_type));
25336 case HMatrixSupport::BlockType::
25337 lower_triangular_block: {
25350 Assert(property == HMatrixSupport::Property::general,
25351 ExcInvalidHMatrixProperty(property));
25353 Vector<Number> local_y(n);
25354 Vector<Number> local_x(m);
25362 x((*row_index_range)[0] -
25366 rkmatrix->Tvmult(local_y, local_x);
25373 y((*col_index_range)[0] -
25375 alpha * local_y(i);
25378 Vector<Number> local_y_for_vmult(m);
25379 Vector<Number> local_x_for_vmult(n);
25386 local_x_for_vmult(j) =
25387 x((*col_index_range)[0] -
25391 rkmatrix->vmult(local_y_for_vmult, local_x_for_vmult);
25398 y((*row_index_range)[0] -
25400 alpha * local_y_for_vmult(i);
25405 case HMatrixSupport::BlockType::
25406 upper_triangular_block: {
25414 throw(ExcInvalidHMatrixBlockType(block_type));
25422 case HMatrixSupport::Property::hermite_symmetric: {
25428 switch (block_type)
25430 case HMatrixSupport::BlockType::diagonal_block: {
25435 throw(ExcInvalidHMatrixBlockType(block_type));
25439 case HMatrixSupport::BlockType::
25440 lower_triangular_block: {
25453 Assert(property == HMatrixSupport::Property::general,
25454 ExcInvalidHMatrixProperty(property));
25456 Vector<Number> local_y(n);
25457 Vector<Number> local_x(m);
25465 x((*row_index_range)[0] -
25469 rkmatrix->Tvmult(local_y, local_x);
25476 y((*col_index_range)[0] -
25478 alpha * local_y(i);
25481 Vector<Number> local_y_for_vmult(m);
25482 Vector<Number> local_x_for_vmult(n);
25489 local_x_for_vmult(j) =
25490 x((*col_index_range)[0] -
25494 rkmatrix->Cvmult(local_y_for_vmult,
25495 local_x_for_vmult);
25502 y((*row_index_range)[0] -
25504 alpha * local_y_for_vmult(i);
25509 case HMatrixSupport::BlockType::
25510 upper_triangular_block: {
25518 throw(ExcInvalidHMatrixBlockType(block_type));
25526 case HMatrixSupport::Property::lower_triangular: {
25532 switch (block_type)
25534 case HMatrixSupport::BlockType::diagonal_block: {
25539 throw(ExcInvalidHMatrixBlockType(block_type));
25543 case HMatrixSupport::BlockType::
25544 lower_triangular_block: {
25550 Assert(property == HMatrixSupport::Property::general,
25551 ExcInvalidHMatrixProperty(property));
25553 Vector<Number> local_y(n);
25554 Vector<Number> local_x(m);
25562 x((*row_index_range)[0] -
25566 rkmatrix->Tvmult(local_y, local_x);
25573 y((*col_index_range)[0] -
25575 alpha * local_y(i);
25580 case HMatrixSupport::BlockType::
25581 upper_triangular_block: {
25589 throw(ExcInvalidHMatrixBlockType(block_type));
25597 case HMatrixSupport::Property::upper_triangular: {
25603 switch (block_type)
25605 case HMatrixSupport::BlockType::diagonal_block: {
25610 throw(ExcInvalidHMatrixBlockType(block_type));
25614 case HMatrixSupport::BlockType::
25615 upper_triangular_block: {
25621 Assert(property == HMatrixSupport::Property::general,
25622 ExcInvalidHMatrixProperty(property));
25624 Vector<Number> local_y(n);
25625 Vector<Number> local_x(m);
25633 x((*row_index_range)[0] -
25637 rkmatrix->Tvmult(local_y, local_x);
25644 y((*col_index_range)[0] -
25646 alpha * local_y(i);
25651 case HMatrixSupport::BlockType::
25652 lower_triangular_block: {
25660 throw(ExcInvalidHMatrixBlockType(block_type));
25669 throw(ExcInvalidHMatrixProperty(top_hmat_property));
25679 Assert(
false, ExcInvalidHMatrixType(type));
25686template <
int spacedim,
typename Number>
25687template <
typename Number2,
typename Number3>
25690 const Number2 beta,
25692 const Number3 alpha,
25693 const Vector<Number> &x)
const
25695 static_assert(is_number_larger_or_equal<Number, Number2>());
25696 static_assert(is_number_larger_or_equal<Number, Number3>());
25700 Assert(parent ==
nullptr, ExcInternalError());
25702 if (property == HMatrixSupport::Property::symmetric)
25704 vmult_serial_iterative(beta, y, alpha, x);
25716 for (
size_type l = 0; l < leaf_set.size(); l++)
25718 const size_type m = this->leaf_set[l]->m;
25719 const size_type n = this->leaf_set[l]->n;
25721 Vector<Number> local_y_for_Tvmult(n);
25722 Vector<Number> local_x_for_Tvmult(m);
25730 local_x_for_Tvmult(i) =
25731 x((*this->leaf_set[l]->row_index_range)[0] + i);
25734 switch (this->leaf_set[l]->type)
25737 this->leaf_set[l]->fullmatrix->Tvmult(local_y_for_Tvmult,
25738 local_x_for_Tvmult);
25743 this->leaf_set[l]->rkmatrix->Tvmult(local_y_for_Tvmult,
25744 local_x_for_Tvmult);
25749 Assert(
false, ExcInvalidHMatrixType(this->leaf_set[l]->type));
25761 y((*this->leaf_set[l]->col_index_range)[0] + j) +=
25762 alpha * local_y_for_Tvmult(j);
25765 if (this->property == HMatrixSupport::Property::hermite_symmetric &&
25766 this->leaf_set[l]->block_type ==
25767 HMatrixSupport::BlockType::lower_triangular_block)
25773 Vector<Number> local_y(m);
25774 Vector<Number> local_x(n);
25781 local_x(j) = x((*this->leaf_set[l]->col_index_range)[0] + j);
25784 switch (this->leaf_set[l]->type)
25787 this->leaf_set[l]->fullmatrix->Cvmult(local_y, local_x);
25792 this->leaf_set[l]->rkmatrix->Cvmult(local_y, local_x);
25798 ExcInvalidHMatrixType(this->leaf_set[l]->type));
25809 y((*this->leaf_set[l]->row_index_range)[0] + i) +=
25810 alpha * local_y(i);
25818template <
int spacedim,
typename Number>
25819template <
typename Number2,
typename Number3>
25823 const Number3 alpha,
25824 const Vector<Number> &x)
const
25826 static_assert(is_number_larger_or_equal<Number, Number2>());
25827 static_assert(is_number_larger_or_equal<Number, Number3>());
25831 Assert(parent ==
nullptr, ExcInternalError());
25833 if (property == HMatrixSupport::Property::symmetric)
25835 vmult_task_parallel(beta, y, alpha, x);
25839 const unsigned int thread_num = data_for_vmult_or_tvmult_threads->size();
25845 if (thread_num > 1)
25848 const int blas_num_threads = openblas_get_num_threads();
25849 openblas_set_num_threads(1);
25856 auto local_scale_and_multiplication =
25857 [
this, beta, alpha, &y, &x](
const unsigned int thread_no) ->
void {
25862 (*this->data_for_vmult_or_tvmult_threads)[thread_no]
25863 .tvmult_result_index_range[0];
25864 i < (*this->data_for_vmult_or_tvmult_threads)[thread_no]
25865 .tvmult_result_index_range[1];
25874 (*this->data_for_vmult_or_tvmult_threads)[thread_no]
25875 .local_tvmult_result = Number(0.);
25876 if (this->property == HMatrixSupport::Property::hermite_symmetric)
25877 (*this->data_for_vmult_or_tvmult_threads)[thread_no]
25878 .local_vmult_result = Number(0.);
25884 for (
unsigned int l =
25885 (*this->data_for_vmult_or_tvmult_threads)[thread_no]
25886 .leaf_set_interval.first;
25887 l <= (*this->data_for_vmult_or_tvmult_threads)[thread_no]
25888 .leaf_set_interval.second;
25891 const size_type m = this->leaf_set[l]->m;
25892 const size_type n = this->leaf_set[l]->n;
25894 Vector<Number> local_y_for_Tvmult(n);
25895 Vector<Number> local_x_for_Tvmult(m);
25902 local_x_for_Tvmult(i) =
25903 x((*this->leaf_set[l]->row_index_range)[0] + i);
25906 switch (this->leaf_set[l]->type)
25909 this->leaf_set[l]->fullmatrix->Tvmult(
25910 local_y_for_Tvmult, local_x_for_Tvmult);
25915 this->leaf_set[l]->rkmatrix->Tvmult(local_y_for_Tvmult,
25916 local_x_for_Tvmult);
25922 ExcInvalidHMatrixType(this->leaf_set[l]->type));
25935 (*this->data_for_vmult_or_tvmult_threads)[thread_no]
25936 .local_tvmult_result(
25937 (*this->leaf_set[l]->col_index_range)[0] -
25938 (*this->data_for_vmult_or_tvmult_threads)[thread_no]
25939 .local_tvmult_result_index_range[0] +
25940 j) += alpha * local_y_for_Tvmult(j);
25943 if (this->property ==
25944 HMatrixSupport::Property::hermite_symmetric &&
25945 this->leaf_set[l]->block_type ==
25946 HMatrixSupport::BlockType::lower_triangular_block)
25952 Vector<Number> local_y(m);
25953 Vector<Number> local_x(n);
25961 x((*this->leaf_set[l]->col_index_range)[0] + j);
25964 switch (this->leaf_set[l]->type)
25967 this->leaf_set[l]->fullmatrix->Cvmult(local_y,
25973 this->leaf_set[l]->rkmatrix->Cvmult(local_y,
25980 ExcInvalidHMatrixType(
25981 this->leaf_set[l]->type));
25994 (*this->data_for_vmult_or_tvmult_threads)[thread_no]
25995 .local_vmult_result(
25996 (*this->leaf_set[l]->row_index_range)[0] -
25997 (*this->data_for_vmult_or_tvmult_threads)[thread_no]
25998 .local_vmult_result_index_range[0] +
25999 i) += alpha * local_y(i);
26005 Threads::TaskGroup<void> local_scaling_and_multiplication_tasks;
26006 for (
unsigned int i = 0; i < thread_num; i++)
26008 local_scaling_and_multiplication_tasks +=
26009 Threads::new_task(std::bind(local_scale_and_multiplication, i));
26012 local_scaling_and_multiplication_tasks.join_all();
26014 auto assemble_contribution_from_all_threads =
26015 [
this, &y](
const unsigned int thread_no) ->
void {
26016 unsigned int other_thread_no = 0;
26017 for (
const auto &range_intersection :
26018 (*this->data_for_vmult_or_tvmult_threads)[thread_no]
26019 .tvmult_result_index_ranges_contributed_from_other_threads)
26021 for (
size_type i = range_intersection[0];
26022 i < range_intersection[1];
26026 (*this->data_for_vmult_or_tvmult_threads)[other_thread_no]
26027 .local_tvmult_result(
26028 i - (*this->data_for_vmult_or_tvmult_threads)
26030 .local_tvmult_result_index_range[0]);
26036 if (this->property == HMatrixSupport::Property::hermite_symmetric)
26038 unsigned int other_thread_no = 0;
26040 const auto &range_intersection :
26041 (*this->data_for_vmult_or_tvmult_threads)[thread_no]
26042 .vmult_result_index_ranges_contributed_from_other_threads)
26044 for (
size_type i = range_intersection[0];
26045 i < range_intersection[1];
26049 (*this->data_for_vmult_or_tvmult_threads)
26051 .local_vmult_result(
26052 i - (*this->data_for_vmult_or_tvmult_threads)
26054 .local_vmult_result_index_range[0]);
26062 Threads::TaskGroup<void> assembly_tasks;
26063 for (
unsigned int i = 0; i < thread_num; i++)
26065 assembly_tasks += Threads::new_task(
26066 std::bind(assemble_contribution_from_all_threads, i));
26069 assembly_tasks.join_all();
26072 openblas_set_num_threads(blas_num_threads);
26076 Tvmult_serial_iterative(beta, y, alpha, x);
26082template <
int spacedim,
typename Number>
26085 const Vector<Number> &x)
const
26087 if (!vmult_strategy)
26089 Assert(
false, ExcInternalError());
26092 vmult_strategy->Tvmult(y, *
this, x);
26096template <
int spacedim,
typename Number>
26099 const Vector<Number> &x)
const
26101 if (!vmult_strategy)
26103 Assert(
false, ExcInternalError());
26106 vmult_strategy->Tvmult_add(y, *
this, x);
26110template <
int spacedim,
typename Number>
26111template <
typename Number2>
26114 const Number2 alpha,
26115 const Vector<Number> &x)
const
26117 if (!vmult_strategy)
26119 Assert(
false, ExcInternalError());
26122 vmult_strategy->Tvmult(y, alpha, *
this, x);
26126template <
int spacedim,
typename Number>
26127template <
typename Number2>
26130 const Number2 alpha,
26131 const Vector<Number> &x)
const
26133 if (!vmult_strategy)
26135 Assert(
false, ExcInternalError());
26138 vmult_strategy->Tvmult_add(y, alpha, *
this, x);
26142template <
int spacedim,
typename Number>
26146 const Vector<Number> &x,
26149 Hvmult(y, real_type(1.0), x, top_hmat_property);
26153template <
int spacedim,
typename Number>
26154template <
typename Number2>
26158 const Number2 alpha,
26159 const Vector<Number> &x,
26162 static_assert(is_number_larger_or_equal<Number, Number2>());
26163 if constexpr (numbers::NumberTraits<Number>::is_complex)
26172 for (
HMatrix *submatrix : submatrices)
26174 submatrix->Hvmult(y, alpha, x, top_hmat_property);
26184 switch (top_hmat_property)
26186 case HMatrixSupport::Property::general: {
26191 Assert(property == HMatrixSupport::Property::general,
26192 ExcInvalidHMatrixProperty(property));
26193 Assert(fullmatrix->get_property() ==
26194 LAPACKSupport::Property::general,
26195 ExcInvalidLAPACKFullMatrixProperty(
26196 fullmatrix->get_property()));
26198 Vector<Number> local_y(n);
26199 Vector<Number> local_x(m);
26206 local_x(j) = x((*row_index_range)[0] + j);
26209 fullmatrix->Hvmult(local_y, local_x);
26216 y((*col_index_range)[0] + i) += alpha * local_y(i);
26221 case HMatrixSupport::Property::symmetric: {
26227 switch (block_type)
26229 case HMatrixSupport::BlockType::diagonal_block: {
26236 HMatrixSupport::Property::symmetric,
26237 ExcInvalidHMatrixProperty(property));
26242 Assert(fullmatrix->get_property() ==
26243 LAPACKSupport::Property::symmetric,
26244 ExcInvalidLAPACKFullMatrixProperty(
26245 fullmatrix->get_property()));
26255 Vector<Number> local_y(n);
26256 Vector<Number> local_x(m);
26264 local_x(j) = x((*row_index_range)[0] + j);
26267 fullmatrix->Hvmult(local_y, local_x);
26274 y((*col_index_range)[0] + i) +=
26275 alpha * local_y(i);
26280 case HMatrixSupport::BlockType::
26281 lower_triangular_block: {
26296 HMatrixSupport::Property::general,
26297 ExcInvalidHMatrixProperty(property));
26298 Assert(fullmatrix->get_property() ==
26299 LAPACKSupport::Property::general,
26300 ExcInvalidLAPACKFullMatrixProperty(
26301 fullmatrix->get_property()));
26303 Vector<Number> local_y(n);
26304 Vector<Number> local_x(m);
26312 local_x(j) = x((*row_index_range)[0] + j);
26315 fullmatrix->Hvmult(local_y, local_x);
26322 y((*col_index_range)[0] + i) +=
26323 alpha * local_y(i);
26326 Vector<Number> local_y_for_vmult(m);
26327 Vector<Number> local_x_for_vmult(n);
26334 local_x_for_vmult(j) =
26335 x((*col_index_range)[0] + j);
26338 fullmatrix->Cvmult(local_y_for_vmult,
26339 local_x_for_vmult);
26346 y((*row_index_range)[0] + i) +=
26347 alpha * local_y_for_vmult(i);
26352 case HMatrixSupport::BlockType::
26353 upper_triangular_block: {
26364 throw(ExcInvalidHMatrixBlockType(block_type));
26372 case HMatrixSupport::Property::hermite_symmetric: {
26378 switch (block_type)
26380 case HMatrixSupport::BlockType::diagonal_block: {
26388 HMatrixSupport::Property::hermite_symmetric,
26389 ExcInvalidHMatrixProperty(property));
26395 fullmatrix->get_property() ==
26396 LAPACKSupport::Property::hermite_symmetric,
26397 ExcInvalidLAPACKFullMatrixProperty(
26398 fullmatrix->get_property()));
26408 Vector<Number> local_y(n);
26409 Vector<Number> local_x(m);
26417 local_x(j) = x((*row_index_range)[0] + j);
26420 fullmatrix->Hvmult(local_y, local_x);
26427 y((*col_index_range)[0] + i) +=
26428 alpha * local_y(i);
26433 case HMatrixSupport::BlockType::
26434 lower_triangular_block: {
26449 HMatrixSupport::Property::general,
26450 ExcInvalidHMatrixProperty(property));
26451 Assert(fullmatrix->get_property() ==
26452 LAPACKSupport::Property::general,
26453 ExcInvalidLAPACKFullMatrixProperty(
26454 fullmatrix->get_property()));
26456 Vector<Number> local_y(n);
26457 Vector<Number> local_x(m);
26465 local_x(j) = x((*row_index_range)[0] + j);
26468 fullmatrix->Hvmult(local_y, local_x);
26475 y((*col_index_range)[0] + i) +=
26476 alpha * local_y(i);
26479 Vector<Number> local_y_for_vmult(m);
26480 Vector<Number> local_x_for_vmult(n);
26487 local_x_for_vmult(j) =
26488 x((*col_index_range)[0] + j);
26491 fullmatrix->vmult(local_y_for_vmult,
26492 local_x_for_vmult);
26499 y((*row_index_range)[0] + i) +=
26500 alpha * local_y_for_vmult(i);
26505 case HMatrixSupport::BlockType::
26506 upper_triangular_block: {
26517 throw(ExcInvalidHMatrixBlockType(block_type));
26525 case HMatrixSupport::Property::lower_triangular: {
26531 switch (block_type)
26533 case HMatrixSupport::BlockType::diagonal_block: {
26541 HMatrixSupport::Property::lower_triangular,
26542 ExcInvalidHMatrixProperty(property));
26548 fullmatrix->get_property() ==
26549 LAPACKSupport::Property::lower_triangular,
26550 ExcInvalidLAPACKFullMatrixProperty(
26551 fullmatrix->get_property()));
26557 Vector<Number> local_y(n);
26558 Vector<Number> local_x(m);
26566 local_x(j) = x((*row_index_range)[0] + j);
26569 fullmatrix->Hvmult(local_y, local_x);
26576 y((*col_index_range)[0] + i) +=
26577 alpha * local_y(i);
26582 case HMatrixSupport::BlockType::
26583 lower_triangular_block: {
26590 HMatrixSupport::Property::general,
26591 ExcInvalidHMatrixProperty(property));
26592 Assert(fullmatrix->get_property() ==
26593 LAPACKSupport::Property::general,
26594 ExcInvalidLAPACKFullMatrixProperty(
26595 fullmatrix->get_property()));
26597 Vector<Number> local_y(n);
26598 Vector<Number> local_x(m);
26606 local_x(j) = x((*row_index_range)[0] + j);
26609 fullmatrix->Hvmult(local_y, local_x);
26616 y((*col_index_range)[0] + i) +=
26617 alpha * local_y(i);
26622 case HMatrixSupport::BlockType::
26623 upper_triangular_block: {
26633 throw(ExcInvalidHMatrixBlockType(block_type));
26641 case HMatrixSupport::Property::upper_triangular: {
26647 switch (block_type)
26649 case HMatrixSupport::BlockType::diagonal_block: {
26657 HMatrixSupport::Property::upper_triangular,
26658 ExcInvalidHMatrixProperty(property));
26664 fullmatrix->get_property() ==
26665 LAPACKSupport::Property::upper_triangular,
26666 ExcInvalidLAPACKFullMatrixProperty(
26667 fullmatrix->get_property()));
26673 Vector<Number> local_y(n);
26674 Vector<Number> local_x(m);
26682 local_x(j) = x((*row_index_range)[0] + j);
26685 fullmatrix->Hvmult(local_y, local_x);
26692 y((*col_index_range)[0] + i) +=
26693 alpha * local_y(i);
26698 case HMatrixSupport::BlockType::
26699 upper_triangular_block: {
26706 HMatrixSupport::Property::general,
26707 ExcInvalidHMatrixProperty(property));
26708 Assert(fullmatrix->get_property() ==
26709 LAPACKSupport::Property::general,
26710 ExcInvalidLAPACKFullMatrixProperty(
26711 fullmatrix->get_property()));
26713 Vector<Number> local_y(n);
26714 Vector<Number> local_x(m);
26722 local_x(j) = x((*row_index_range)[0] + j);
26725 fullmatrix->Hvmult(local_y, local_x);
26732 y((*col_index_range)[0] + i) +=
26733 alpha * local_y(i);
26738 case HMatrixSupport::BlockType::
26739 lower_triangular_block: {
26747 throw(ExcInvalidHMatrixBlockType(block_type));
26756 throw(ExcInvalidHMatrixProperty(top_hmat_property));
26769 switch (top_hmat_property)
26771 case HMatrixSupport::Property::general: {
26776 Assert(property == HMatrixSupport::Property::general,
26777 ExcInvalidHMatrixProperty(property));
26779 Vector<Number> local_y(n);
26780 Vector<Number> local_x(m);
26787 local_x(j) = x((*row_index_range)[0] + j);
26790 rkmatrix->Hvmult(local_y, local_x);
26797 y((*col_index_range)[0] + i) += alpha * local_y(i);
26802 case HMatrixSupport::Property::symmetric: {
26808 switch (block_type)
26810 case HMatrixSupport::BlockType::diagonal_block: {
26815 throw(ExcInvalidHMatrixBlockType(block_type));
26819 case HMatrixSupport::BlockType::
26820 lower_triangular_block: {
26835 HMatrixSupport::Property::general,
26836 ExcInvalidHMatrixProperty(property));
26838 Vector<Number> local_y(n);
26839 Vector<Number> local_x(m);
26847 local_x(j) = x((*row_index_range)[0] + j);
26850 rkmatrix->Hvmult(local_y, local_x);
26857 y((*col_index_range)[0] + i) +=
26858 alpha * local_y(i);
26861 Vector<Number> local_y_for_vmult(m);
26862 Vector<Number> local_x_for_vmult(n);
26869 local_x_for_vmult(j) =
26870 x((*col_index_range)[0] + j);
26873 rkmatrix->Cvmult(local_y_for_vmult,
26874 local_x_for_vmult);
26881 y((*row_index_range)[0] + i) +=
26882 alpha * local_y_for_vmult(i);
26887 case HMatrixSupport::BlockType::
26888 upper_triangular_block: {
26896 throw(ExcInvalidHMatrixBlockType(block_type));
26904 case HMatrixSupport::Property::hermite_symmetric: {
26910 switch (block_type)
26912 case HMatrixSupport::BlockType::diagonal_block: {
26917 throw(ExcInvalidHMatrixBlockType(block_type));
26921 case HMatrixSupport::BlockType::
26922 lower_triangular_block: {
26937 HMatrixSupport::Property::general,
26938 ExcInvalidHMatrixProperty(property));
26940 Vector<Number> local_y(n);
26941 Vector<Number> local_x(m);
26949 local_x(j) = x((*row_index_range)[0] + j);
26952 rkmatrix->Hvmult(local_y, local_x);
26959 y((*col_index_range)[0] + i) +=
26960 alpha * local_y(i);
26963 Vector<Number> local_y_for_vmult(m);
26964 Vector<Number> local_x_for_vmult(n);
26971 local_x_for_vmult(j) =
26972 x((*col_index_range)[0] + j);
26975 rkmatrix->vmult(local_y_for_vmult,
26976 local_x_for_vmult);
26983 y((*row_index_range)[0] + i) +=
26984 alpha * local_y_for_vmult(i);
26989 case HMatrixSupport::BlockType::
26990 upper_triangular_block: {
26998 throw(ExcInvalidHMatrixBlockType(block_type));
27006 case HMatrixSupport::Property::lower_triangular: {
27012 switch (block_type)
27014 case HMatrixSupport::BlockType::diagonal_block: {
27019 throw(ExcInvalidHMatrixBlockType(block_type));
27023 case HMatrixSupport::BlockType::
27024 lower_triangular_block: {
27031 HMatrixSupport::Property::general,
27032 ExcInvalidHMatrixProperty(property));
27034 Vector<Number> local_y(n);
27035 Vector<Number> local_x(m);
27042 local_x(j) = x((*row_index_range)[0] + j);
27045 rkmatrix->Hvmult(local_y, local_x);
27052 y((*col_index_range)[0] + i) +=
27053 alpha * local_y(i);
27058 case HMatrixSupport::BlockType::
27059 upper_triangular_block: {
27067 throw(ExcInvalidHMatrixBlockType(block_type));
27075 case HMatrixSupport::Property::upper_triangular: {
27081 switch (block_type)
27083 case HMatrixSupport::BlockType::diagonal_block: {
27088 throw(ExcInvalidHMatrixBlockType(block_type));
27092 case HMatrixSupport::BlockType::
27093 upper_triangular_block: {
27100 HMatrixSupport::Property::general,
27101 ExcInvalidHMatrixProperty(property));
27103 Vector<Number> local_y(n);
27104 Vector<Number> local_x(m);
27111 local_x(j) = x((*row_index_range)[0] + j);
27114 rkmatrix->Hvmult(local_y, local_x);
27121 y((*col_index_range)[0] + i) +=
27122 alpha * local_y(i);
27127 case HMatrixSupport::BlockType::
27128 lower_triangular_block: {
27136 throw(ExcInvalidHMatrixBlockType(block_type));
27145 throw(ExcInvalidHMatrixProperty(top_hmat_property));
27155 Assert(
false, ExcInvalidHMatrixType(type));
27162 this->Tvmult(y, alpha, x, top_hmat_property);
27167template <
int spacedim,
typename Number>
27171 const Vector<Number> &x,
27175 Hvmult(y, real_type(1.0), x, starting_hmat, top_hmat_property);
27179template <
int spacedim,
typename Number>
27180template <
typename Number2>
27184 const Number2 alpha,
27185 const Vector<Number> &x,
27189 static_assert(is_number_larger_or_equal<Number, Number2>());
27190 if constexpr (numbers::NumberTraits<Number>::is_complex)
27199 for (
HMatrix *submatrix : submatrices)
27202 y, alpha, x, starting_hmat, top_hmat_property);
27212 switch (top_hmat_property)
27214 case HMatrixSupport::Property::general: {
27219 Assert(property == HMatrixSupport::Property::general,
27220 ExcInvalidHMatrixProperty(property));
27221 Assert(fullmatrix->get_property() ==
27222 LAPACKSupport::Property::general,
27223 ExcInvalidLAPACKFullMatrixProperty(
27224 fullmatrix->get_property()));
27226 Vector<Number> local_y(n);
27227 Vector<Number> local_x(m);
27235 x((*row_index_range)[0] -
27239 fullmatrix->Hvmult(local_y, local_x);
27246 y((*col_index_range)[0] -
27248 alpha * local_y(i);
27253 case HMatrixSupport::Property::symmetric: {
27259 switch (block_type)
27261 case HMatrixSupport::BlockType::diagonal_block: {
27268 HMatrixSupport::Property::symmetric,
27269 ExcInvalidHMatrixProperty(property));
27274 Assert(fullmatrix->get_property() ==
27275 LAPACKSupport::Property::symmetric,
27276 ExcInvalidLAPACKFullMatrixProperty(
27277 fullmatrix->get_property()));
27287 Vector<Number> local_y(n);
27288 Vector<Number> local_x(m);
27297 x((*row_index_range)[0] -
27301 fullmatrix->Hvmult(local_y, local_x);
27308 y((*col_index_range)[0] -
27310 alpha * local_y(i);
27315 case HMatrixSupport::BlockType::
27316 lower_triangular_block: {
27331 HMatrixSupport::Property::general,
27332 ExcInvalidHMatrixProperty(property));
27333 Assert(fullmatrix->get_property() ==
27334 LAPACKSupport::Property::general,
27335 ExcInvalidLAPACKFullMatrixProperty(
27336 fullmatrix->get_property()));
27338 Vector<Number> local_y(n);
27339 Vector<Number> local_x(m);
27348 x((*row_index_range)[0] -
27352 fullmatrix->Hvmult(local_y, local_x);
27359 y((*col_index_range)[0] -
27361 alpha * local_y(i);
27364 Vector<Number> local_y_for_vmult(m);
27365 Vector<Number> local_x_for_vmult(n);
27372 local_x_for_vmult(j) =
27373 x((*col_index_range)[0] -
27377 fullmatrix->Cvmult(local_y_for_vmult,
27378 local_x_for_vmult);
27385 y((*row_index_range)[0] -
27387 alpha * local_y_for_vmult(i);
27392 case HMatrixSupport::BlockType::
27393 upper_triangular_block: {
27404 throw(ExcInvalidHMatrixBlockType(block_type));
27412 case HMatrixSupport::Property::hermite_symmetric: {
27418 switch (block_type)
27420 case HMatrixSupport::BlockType::diagonal_block: {
27428 HMatrixSupport::Property::hermite_symmetric,
27429 ExcInvalidHMatrixProperty(property));
27435 fullmatrix->get_property() ==
27436 LAPACKSupport::Property::hermite_symmetric,
27437 ExcInvalidLAPACKFullMatrixProperty(
27438 fullmatrix->get_property()));
27448 Vector<Number> local_y(n);
27449 Vector<Number> local_x(m);
27458 x((*row_index_range)[0] -
27462 fullmatrix->Hvmult(local_y, local_x);
27469 y((*col_index_range)[0] -
27471 alpha * local_y(i);
27476 case HMatrixSupport::BlockType::
27477 lower_triangular_block: {
27492 HMatrixSupport::Property::general,
27493 ExcInvalidHMatrixProperty(property));
27494 Assert(fullmatrix->get_property() ==
27495 LAPACKSupport::Property::general,
27496 ExcInvalidLAPACKFullMatrixProperty(
27497 fullmatrix->get_property()));
27499 Vector<Number> local_y(n);
27500 Vector<Number> local_x(m);
27509 x((*row_index_range)[0] -
27513 fullmatrix->Hvmult(local_y, local_x);
27520 y((*col_index_range)[0] -
27522 alpha * local_y(i);
27525 Vector<Number> local_y_for_vmult(m);
27526 Vector<Number> local_x_for_vmult(n);
27533 local_x_for_vmult(j) =
27534 x((*col_index_range)[0] -
27538 fullmatrix->vmult(local_y_for_vmult,
27539 local_x_for_vmult);
27546 y((*row_index_range)[0] -
27548 alpha * local_y_for_vmult(i);
27553 case HMatrixSupport::BlockType::
27554 upper_triangular_block: {
27565 throw(ExcInvalidHMatrixBlockType(block_type));
27573 case HMatrixSupport::Property::lower_triangular: {
27579 switch (block_type)
27581 case HMatrixSupport::BlockType::diagonal_block: {
27589 HMatrixSupport::Property::lower_triangular,
27590 ExcInvalidHMatrixProperty(property));
27596 fullmatrix->get_property() ==
27597 LAPACKSupport::Property::lower_triangular,
27598 ExcInvalidLAPACKFullMatrixProperty(
27599 fullmatrix->get_property()));
27605 Vector<Number> local_y(n);
27606 Vector<Number> local_x(m);
27615 x((*row_index_range)[0] -
27619 fullmatrix->Hvmult(local_y, local_x);
27626 y((*col_index_range)[0] -
27628 alpha * local_y(i);
27633 case HMatrixSupport::BlockType::
27634 lower_triangular_block: {
27641 HMatrixSupport::Property::general,
27642 ExcInvalidHMatrixProperty(property));
27643 Assert(fullmatrix->get_property() ==
27644 LAPACKSupport::Property::general,
27645 ExcInvalidLAPACKFullMatrixProperty(
27646 fullmatrix->get_property()));
27648 Vector<Number> local_y(n);
27649 Vector<Number> local_x(m);
27658 x((*row_index_range)[0] -
27662 fullmatrix->Hvmult(local_y, local_x);
27669 y((*col_index_range)[0] -
27671 alpha * local_y(i);
27676 case HMatrixSupport::BlockType::
27677 upper_triangular_block: {
27687 throw(ExcInvalidHMatrixBlockType(block_type));
27695 case HMatrixSupport::Property::upper_triangular: {
27701 switch (block_type)
27703 case HMatrixSupport::BlockType::diagonal_block: {
27711 HMatrixSupport::Property::upper_triangular,
27712 ExcInvalidHMatrixProperty(property));
27718 fullmatrix->get_property() ==
27719 LAPACKSupport::Property::upper_triangular,
27720 ExcInvalidLAPACKFullMatrixProperty(
27721 fullmatrix->get_property()));
27727 Vector<Number> local_y(n);
27728 Vector<Number> local_x(m);
27737 x((*row_index_range)[0] -
27741 fullmatrix->Hvmult(local_y, local_x);
27748 y((*col_index_range)[0] -
27750 alpha * local_y(i);
27755 case HMatrixSupport::BlockType::
27756 upper_triangular_block: {
27763 HMatrixSupport::Property::general,
27764 ExcInvalidHMatrixProperty(property));
27765 Assert(fullmatrix->get_property() ==
27766 LAPACKSupport::Property::general,
27767 ExcInvalidLAPACKFullMatrixProperty(
27768 fullmatrix->get_property()));
27770 Vector<Number> local_y(n);
27771 Vector<Number> local_x(m);
27780 x((*row_index_range)[0] -
27784 fullmatrix->Hvmult(local_y, local_x);
27791 y((*col_index_range)[0] -
27793 alpha * local_y(i);
27798 case HMatrixSupport::BlockType::
27799 lower_triangular_block: {
27807 throw(ExcInvalidHMatrixBlockType(block_type));
27816 throw(ExcInvalidHMatrixProperty(top_hmat_property));
27829 switch (top_hmat_property)
27831 case HMatrixSupport::Property::general: {
27836 Assert(property == HMatrixSupport::Property::general,
27837 ExcInvalidHMatrixProperty(property));
27839 Vector<Number> local_y(n);
27840 Vector<Number> local_x(m);
27848 x((*row_index_range)[0] -
27852 rkmatrix->Hvmult(local_y, local_x);
27859 y((*col_index_range)[0] -
27861 alpha * local_y(i);
27866 case HMatrixSupport::Property::symmetric: {
27872 switch (block_type)
27874 case HMatrixSupport::BlockType::diagonal_block: {
27879 throw(ExcInvalidHMatrixBlockType(block_type));
27883 case HMatrixSupport::BlockType::
27884 lower_triangular_block: {
27899 HMatrixSupport::Property::general,
27900 ExcInvalidHMatrixProperty(property));
27902 Vector<Number> local_y(n);
27903 Vector<Number> local_x(m);
27911 x((*row_index_range)[0] -
27915 rkmatrix->Hvmult(local_y, local_x);
27922 y((*col_index_range)[0] -
27924 alpha * local_y(i);
27927 Vector<Number> local_y_for_vmult(m);
27928 Vector<Number> local_x_for_vmult(n);
27935 local_x_for_vmult(j) =
27936 x((*col_index_range)[0] -
27940 rkmatrix->Cvmult(local_y_for_vmult,
27941 local_x_for_vmult);
27948 y((*row_index_range)[0] -
27950 alpha * local_y_for_vmult(i);
27955 case HMatrixSupport::BlockType::
27956 upper_triangular_block: {
27964 throw(ExcInvalidHMatrixBlockType(block_type));
27972 case HMatrixSupport::Property::hermite_symmetric: {
27978 switch (block_type)
27980 case HMatrixSupport::BlockType::diagonal_block: {
27985 throw(ExcInvalidHMatrixBlockType(block_type));
27989 case HMatrixSupport::BlockType::
27990 lower_triangular_block: {
28005 HMatrixSupport::Property::general,
28006 ExcInvalidHMatrixProperty(property));
28008 Vector<Number> local_y(n);
28009 Vector<Number> local_x(m);
28017 x((*row_index_range)[0] -
28021 rkmatrix->Hvmult(local_y, local_x);
28028 y((*col_index_range)[0] -
28030 alpha * local_y(i);
28033 Vector<Number> local_y_for_vmult(m);
28034 Vector<Number> local_x_for_vmult(n);
28041 local_x_for_vmult(j) =
28042 x((*col_index_range)[0] -
28046 rkmatrix->vmult(local_y_for_vmult,
28047 local_x_for_vmult);
28054 y((*row_index_range)[0] -
28056 alpha * local_y_for_vmult(i);
28061 case HMatrixSupport::BlockType::
28062 upper_triangular_block: {
28070 throw(ExcInvalidHMatrixBlockType(block_type));
28078 case HMatrixSupport::Property::lower_triangular: {
28084 switch (block_type)
28086 case HMatrixSupport::BlockType::diagonal_block: {
28091 throw(ExcInvalidHMatrixBlockType(block_type));
28095 case HMatrixSupport::BlockType::
28096 lower_triangular_block: {
28103 HMatrixSupport::Property::general,
28104 ExcInvalidHMatrixProperty(property));
28106 Vector<Number> local_y(n);
28107 Vector<Number> local_x(m);
28115 x((*row_index_range)[0] -
28119 rkmatrix->Hvmult(local_y, local_x);
28126 y((*col_index_range)[0] -
28128 alpha * local_y(i);
28133 case HMatrixSupport::BlockType::
28134 upper_triangular_block: {
28142 throw(ExcInvalidHMatrixBlockType(block_type));
28150 case HMatrixSupport::Property::upper_triangular: {
28156 switch (block_type)
28158 case HMatrixSupport::BlockType::diagonal_block: {
28163 throw(ExcInvalidHMatrixBlockType(block_type));
28167 case HMatrixSupport::BlockType::
28168 upper_triangular_block: {
28175 HMatrixSupport::Property::general,
28176 ExcInvalidHMatrixProperty(property));
28178 Vector<Number> local_y(n);
28179 Vector<Number> local_x(m);
28187 x((*row_index_range)[0] -
28191 rkmatrix->Hvmult(local_y, local_x);
28198 y((*col_index_range)[0] -
28200 alpha * local_y(i);
28205 case HMatrixSupport::BlockType::
28206 lower_triangular_block: {
28214 throw(ExcInvalidHMatrixBlockType(block_type));
28223 throw(ExcInvalidHMatrixProperty(top_hmat_property));
28233 Assert(
false, ExcInvalidHMatrixType(type));
28240 this->Tvmult(y, alpha, x, starting_hmat, top_hmat_property);
28245template <
int spacedim,
typename Number>
28246template <
typename Number2,
typename Number3>
28249 const Number2 beta,
28251 const Number3 alpha,
28252 const Vector<Number> &x)
const
28254 static_assert(is_number_larger_or_equal<Number, Number2>());
28255 static_assert(is_number_larger_or_equal<Number, Number3>());
28259 Assert(parent ==
nullptr, ExcInternalError());
28261 if constexpr (numbers::NumberTraits<Number>::is_complex)
28263 if (property == HMatrixSupport::Property::hermite_symmetric)
28265 vmult_serial_iterative(beta, y, alpha, x);
28277 for (
size_type l = 0; l < leaf_set.size(); l++)
28279 const size_type m = this->leaf_set[l]->m;
28280 const size_type n = this->leaf_set[l]->n;
28282 Vector<Number> local_y_for_Hvmult(n);
28283 Vector<Number> local_x_for_Hvmult(m);
28291 local_x_for_Hvmult(i) =
28292 x((*this->leaf_set[l]->row_index_range)[0] + i);
28295 switch (this->leaf_set[l]->type)
28298 this->leaf_set[l]->fullmatrix->Hvmult(local_y_for_Hvmult,
28299 local_x_for_Hvmult);
28304 this->leaf_set[l]->rkmatrix->Hvmult(local_y_for_Hvmult,
28305 local_x_for_Hvmult);
28311 ExcInvalidHMatrixType(this->leaf_set[l]->type));
28323 y((*this->leaf_set[l]->col_index_range)[0] + j) +=
28324 alpha * local_y_for_Hvmult(j);
28327 if (this->property == HMatrixSupport::Property::symmetric &&
28328 this->leaf_set[l]->block_type ==
28329 HMatrixSupport::BlockType::lower_triangular_block)
28335 Vector<Number> local_y(m);
28336 Vector<Number> local_x(n);
28344 x((*this->leaf_set[l]->col_index_range)[0] + j);
28347 switch (this->leaf_set[l]->type)
28350 this->leaf_set[l]->fullmatrix->Cvmult(local_y,
28356 this->leaf_set[l]->rkmatrix->Cvmult(local_y, local_x);
28362 ExcInvalidHMatrixType(
28363 this->leaf_set[l]->type));
28374 y((*this->leaf_set[l]->row_index_range)[0] + i) +=
28375 alpha * local_y(i);
28383 this->Tvmult_serial_iterative(beta, y, alpha, x);
28388template <
int spacedim,
typename Number>
28389template <
typename Number2,
typename Number3>
28393 const Number3 alpha,
28394 const Vector<Number> &x)
const
28396 static_assert(is_number_larger_or_equal<Number, Number2>());
28397 static_assert(is_number_larger_or_equal<Number, Number3>());
28401 Assert(parent ==
nullptr, ExcInternalError());
28403 if constexpr (numbers::NumberTraits<Number>::is_complex)
28405 if (property == HMatrixSupport::Property::hermite_symmetric)
28407 vmult_task_parallel(beta, y, alpha, x);
28411 const unsigned int thread_num =
28412 data_for_vmult_or_tvmult_threads->size();
28418 if (thread_num > 1)
28422 const int blas_num_threads = openblas_get_num_threads();
28423 openblas_set_num_threads(1);
28430 auto local_scale_and_multiplication =
28431 [
this, beta, alpha, &y, &x](
28432 const unsigned int thread_no) ->
void {
28437 (*this->data_for_vmult_or_tvmult_threads)[thread_no]
28438 .tvmult_result_index_range[0];
28439 i < (*this->data_for_vmult_or_tvmult_threads)[thread_no]
28440 .tvmult_result_index_range[1];
28450 (*this->data_for_vmult_or_tvmult_threads)[thread_no]
28451 .local_tvmult_result = Number(0.);
28452 if (this->property == HMatrixSupport::Property::symmetric)
28453 (*this->data_for_vmult_or_tvmult_threads)[thread_no]
28454 .local_vmult_result = Number(0.);
28460 for (
unsigned int l =
28461 (*this->data_for_vmult_or_tvmult_threads)[thread_no]
28462 .leaf_set_interval.first;
28463 l <= (*this->data_for_vmult_or_tvmult_threads)[thread_no]
28464 .leaf_set_interval.second;
28467 const size_type m = this->leaf_set[l]->m;
28468 const size_type n = this->leaf_set[l]->n;
28470 Vector<Number> local_y_for_Hvmult(n);
28471 Vector<Number> local_x_for_Hvmult(m);
28478 local_x_for_Hvmult(i) =
28479 x((*this->leaf_set[l]->row_index_range)[0] + i);
28482 switch (this->leaf_set[l]->type)
28485 this->leaf_set[l]->fullmatrix->Hvmult(
28486 local_y_for_Hvmult, local_x_for_Hvmult);
28491 this->leaf_set[l]->rkmatrix->Hvmult(
28492 local_y_for_Hvmult, local_x_for_Hvmult);
28498 ExcInvalidHMatrixType(
28499 this->leaf_set[l]->type));
28512 (*this->data_for_vmult_or_tvmult_threads)[thread_no]
28513 .local_tvmult_result(
28514 (*this->leaf_set[l]->col_index_range)[0] -
28515 (*this->data_for_vmult_or_tvmult_threads)[thread_no]
28516 .local_tvmult_result_index_range[0] +
28517 j) += alpha * local_y_for_Hvmult(j);
28520 if (this->property == HMatrixSupport::Property::symmetric &&
28521 this->leaf_set[l]->block_type ==
28522 HMatrixSupport::BlockType::lower_triangular_block)
28528 Vector<Number> local_y(m);
28529 Vector<Number> local_x(n);
28537 x((*this->leaf_set[l]->col_index_range)[0] + j);
28540 switch (this->leaf_set[l]->type)
28543 this->leaf_set[l]->fullmatrix->Cvmult(local_y,
28549 this->leaf_set[l]->rkmatrix->Cvmult(local_y,
28556 ExcInvalidHMatrixType(
28557 this->leaf_set[l]->type));
28570 (*this->data_for_vmult_or_tvmult_threads)[thread_no]
28571 .local_vmult_result(
28572 (*this->leaf_set[l]->row_index_range)[0] -
28573 (*this->data_for_vmult_or_tvmult_threads)
28575 .local_vmult_result_index_range[0] +
28576 i) += alpha * local_y(i);
28582 Threads::TaskGroup<void> local_scaling_and_multiplication_tasks;
28583 for (
unsigned int i = 0; i < thread_num; i++)
28585 local_scaling_and_multiplication_tasks += Threads::new_task(
28586 std::bind(local_scale_and_multiplication, i));
28589 local_scaling_and_multiplication_tasks.join_all();
28591 auto assemble_contribution_from_all_threads =
28592 [
this, &y](
const unsigned int thread_no) ->
void {
28593 unsigned int other_thread_no = 0;
28595 const auto &range_intersection :
28596 (*this->data_for_vmult_or_tvmult_threads)[thread_no]
28597 .tvmult_result_index_ranges_contributed_from_other_threads)
28599 for (
size_type i = range_intersection[0];
28600 i < range_intersection[1];
28604 (*this->data_for_vmult_or_tvmult_threads)
28606 .local_tvmult_result(
28607 i - (*this->data_for_vmult_or_tvmult_threads)
28609 .local_tvmult_result_index_range[0]);
28615 if (this->property == HMatrixSupport::Property::symmetric)
28617 unsigned int other_thread_no = 0;
28619 const auto &range_intersection :
28620 (*this->data_for_vmult_or_tvmult_threads)[thread_no]
28621 .vmult_result_index_ranges_contributed_from_other_threads)
28623 for (
size_type i = range_intersection[0];
28624 i < range_intersection[1];
28628 (*this->data_for_vmult_or_tvmult_threads)
28630 .local_vmult_result(
28632 (*this->data_for_vmult_or_tvmult_threads)
28634 .local_vmult_result_index_range[0]);
28642 Threads::TaskGroup<void> assembly_tasks;
28643 for (
unsigned int i = 0; i < thread_num; i++)
28645 assembly_tasks += Threads::new_task(
28646 std::bind(assemble_contribution_from_all_threads, i));
28649 assembly_tasks.join_all();
28652 openblas_set_num_threads(blas_num_threads);
28656 Hvmult_serial_iterative(beta, y, alpha, x);
28662 Tvmult_task_parallel(beta, y, alpha, x);
28667template <
int spacedim,
typename Number>
28670 const Vector<Number> &x)
const
28672 if (!vmult_strategy)
28674 Assert(
false, ExcInternalError());
28677 vmult_strategy->Hvmult(y, *
this, x);
28681template <
int spacedim,
typename Number>
28684 const Vector<Number> &x)
const
28686 if (!vmult_strategy)
28688 Assert(
false, ExcInternalError());
28691 vmult_strategy->Hvmult_add(y, *
this, x);
28695template <
int spacedim,
typename Number>
28696template <
typename Number2>
28699 const Number2 alpha,
28700 const Vector<Number> &x)
const
28702 if (!vmult_strategy)
28704 Assert(
false, ExcInternalError());
28707 vmult_strategy->Hvmult(y, alpha, *
this, x);
28711template <
int spacedim,
typename Number>
28712template <
typename Number2>
28715 const Number2 alpha,
28716 const Vector<Number> &x)
const
28718 if (!vmult_strategy)
28720 Assert(
false, ExcInternalError());
28723 vmult_strategy->Hvmult_add(y, alpha, *
this, x);
28727template <
int spacedim,
typename Number>
28733 Sigma_P_cannot_reduced;
28735 while (Sigma_P.size() > 0)
28739 &hmat_pair = Sigma_P.back();
28763 else if (M1->
bc_node->get_split_mode() == VerticalSplitMode &&
28764 M2->
bc_node->get_split_mode() == HorizontalSplitMode)
28767 Sigma_P.pop_back();
28787 Sigma_P_cannot_reduced.push_back(hmat_pair);
28793 Sigma_P.pop_back();
28802 hmat_pair : Sigma_P_cannot_reduced)
28804 Sigma_P.push_back(hmat_pair);
28809template <
int spacedim,
typename Number>
28825 submatrices.push_back(child_hmat0);
28833 submatrices.push_back(child_hmat1);
28838 while (Sigma_P.size() > 0)
28842 &hmat_pair = Sigma_P.back();
28848 if (hmat_pair.first->bc_node->get_split_mode() == HorizontalSplitMode &&
28849 hmat_pair.second->bc_node->get_split_mode() == UnsplitMode)
28851 Assert(hmat_pair.first->submatrices[0], ExcInternalError());
28852 child_hmat0->
Sigma_P.push_back(
28854 hmat_pair.first->submatrices[0], hmat_pair.second));
28856 Assert(hmat_pair.first->submatrices[1], ExcInternalError());
28857 child_hmat1->
Sigma_P.push_back(
28859 hmat_pair.first->submatrices[1], hmat_pair.second));
28865 Sigma_P.pop_back();
28867 else if (hmat_pair.first->bc_node->get_split_mode() == CrossSplitMode &&
28868 hmat_pair.second->bc_node->get_split_mode() ==
28869 HorizontalSplitMode)
28871 Assert(hmat_pair.first->submatrices[0], ExcInternalError());
28872 Assert(hmat_pair.second->submatrices[0], ExcInternalError());
28873 child_hmat0->
Sigma_P.push_back(
28875 hmat_pair.first->submatrices[0],
28876 hmat_pair.second->submatrices[0]));
28878 Assert(hmat_pair.first->submatrices[1], ExcInternalError());
28879 Assert(hmat_pair.second->submatrices[1], ExcInternalError());
28880 child_hmat0->
Sigma_P.push_back(
28882 hmat_pair.first->submatrices[1],
28883 hmat_pair.second->submatrices[1]));
28885 Assert(hmat_pair.first->submatrices[2], ExcInternalError());
28886 child_hmat1->
Sigma_P.push_back(
28888 hmat_pair.first->submatrices[2],
28889 hmat_pair.second->submatrices[0]));
28891 Assert(hmat_pair.first->submatrices[3], ExcInternalError());
28892 child_hmat1->
Sigma_P.push_back(
28894 hmat_pair.first->submatrices[3],
28895 hmat_pair.second->submatrices[1]));
28901 Sigma_P.pop_back();
28905 Assert(
false, ExcInternalError());
28917template <
int spacedim,
typename Number>
28933 submatrices.push_back(child_hmat0);
28941 submatrices.push_back(child_hmat1);
28946 while (Sigma_P.size() > 0)
28950 &hmat_pair = Sigma_P.back();
28956 if (hmat_pair.first->bc_node->get_split_mode() == UnsplitMode &&
28957 hmat_pair.second->bc_node->get_split_mode() == VerticalSplitMode)
28959 Assert(hmat_pair.second->submatrices[0], ExcInternalError());
28960 child_hmat0->
Sigma_P.push_back(
28962 hmat_pair.first, hmat_pair.second->submatrices[0]));
28964 Assert(hmat_pair.second->submatrices[1], ExcInternalError());
28965 child_hmat1->
Sigma_P.push_back(
28967 hmat_pair.first, hmat_pair.second->submatrices[1]));
28973 Sigma_P.pop_back();
28975 else if (hmat_pair.first->bc_node->get_split_mode() ==
28976 VerticalSplitMode &&
28977 hmat_pair.second->bc_node->get_split_mode() == CrossSplitMode)
28979 Assert(hmat_pair.first->submatrices[0], ExcInternalError());
28980 Assert(hmat_pair.second->submatrices[0], ExcInternalError());
28981 child_hmat0->
Sigma_P.push_back(
28983 hmat_pair.first->submatrices[0],
28984 hmat_pair.second->submatrices[0]));
28986 Assert(hmat_pair.first->submatrices[1], ExcInternalError());
28987 Assert(hmat_pair.second->submatrices[2], ExcInternalError());
28988 child_hmat0->
Sigma_P.push_back(
28990 hmat_pair.first->submatrices[1],
28991 hmat_pair.second->submatrices[2]));
28993 Assert(hmat_pair.second->submatrices[1], ExcInternalError());
28994 child_hmat1->
Sigma_P.push_back(
28996 hmat_pair.first->submatrices[0],
28997 hmat_pair.second->submatrices[1]));
28999 Assert(hmat_pair.second->submatrices[3], ExcInternalError());
29000 child_hmat1->
Sigma_P.push_back(
29002 hmat_pair.first->submatrices[1],
29003 hmat_pair.second->submatrices[3]));
29009 Sigma_P.pop_back();
29013 Assert(
false, ExcInternalError());
29025template <
int spacedim,
typename Number>
29041 submatrices.push_back(child_hmat0);
29049 submatrices.push_back(child_hmat1);
29057 submatrices.push_back(child_hmat2);
29065 submatrices.push_back(child_hmat3);
29070 while (Sigma_P.size() > 0)
29074 &hmat_pair = Sigma_P.back();
29080 if (hmat_pair.first->bc_node->get_split_mode() == CrossSplitMode &&
29081 hmat_pair.second->bc_node->get_split_mode() == CrossSplitMode)
29088 Assert(hmat_pair.first->submatrices[0], ExcInternalError());
29089 Assert(hmat_pair.second->submatrices[0], ExcInternalError());
29090 child_hmat0->
Sigma_P.push_back(
29092 hmat_pair.first->submatrices[0],
29093 hmat_pair.second->submatrices[0]));
29095 Assert(hmat_pair.first->submatrices[1], ExcInternalError());
29096 Assert(hmat_pair.second->submatrices[2], ExcInternalError());
29097 child_hmat0->
Sigma_P.push_back(
29099 hmat_pair.first->submatrices[1],
29100 hmat_pair.second->submatrices[2]));
29107 Assert(hmat_pair.second->submatrices[1], ExcInternalError());
29108 child_hmat1->
Sigma_P.push_back(
29110 hmat_pair.first->submatrices[0],
29111 hmat_pair.second->submatrices[1]));
29113 Assert(hmat_pair.second->submatrices[3], ExcInternalError());
29114 child_hmat1->
Sigma_P.push_back(
29116 hmat_pair.first->submatrices[1],
29117 hmat_pair.second->submatrices[3]));
29124 Assert(hmat_pair.first->submatrices[2], ExcInternalError());
29125 child_hmat2->
Sigma_P.push_back(
29127 hmat_pair.first->submatrices[2],
29128 hmat_pair.second->submatrices[0]));
29130 Assert(hmat_pair.first->submatrices[3], ExcInternalError());
29131 child_hmat2->
Sigma_P.push_back(
29133 hmat_pair.first->submatrices[3],
29134 hmat_pair.second->submatrices[2]));
29141 child_hmat3->
Sigma_P.push_back(
29143 hmat_pair.first->submatrices[2],
29144 hmat_pair.second->submatrices[1]));
29146 child_hmat3->
Sigma_P.push_back(
29148 hmat_pair.first->submatrices[3],
29149 hmat_pair.second->submatrices[3]));
29155 Sigma_P.pop_back();
29157 else if (hmat_pair.first->bc_node->get_split_mode() ==
29158 HorizontalSplitMode &&
29159 hmat_pair.second->bc_node->get_split_mode() == VerticalSplitMode)
29161 Assert(hmat_pair.first->submatrices[0], ExcInternalError());
29162 Assert(hmat_pair.second->submatrices[0], ExcInternalError());
29163 child_hmat0->
Sigma_P.push_back(
29165 hmat_pair.first->submatrices[0],
29166 hmat_pair.second->submatrices[0]));
29168 Assert(hmat_pair.second->submatrices[1], ExcInternalError());
29169 child_hmat1->
Sigma_P.push_back(
29171 hmat_pair.first->submatrices[0],
29172 hmat_pair.second->submatrices[1]));
29174 Assert(hmat_pair.first->submatrices[1], ExcInternalError());
29175 child_hmat2->
Sigma_P.push_back(
29177 hmat_pair.first->submatrices[1],
29178 hmat_pair.second->submatrices[0]));
29180 child_hmat3->
Sigma_P.push_back(
29182 hmat_pair.first->submatrices[1],
29183 hmat_pair.second->submatrices[1]));
29189 Sigma_P.pop_back();
29193 Assert(
false, ExcInternalError());
29205template <
int spacedim,
typename Number>
29213 const unsigned int fixed_rank)
29240 initial_hmat_pair(
this, &B);
29296template <
int spacedim,
typename Number>
29304 const unsigned int fixed_rank,
29310 mmult(C_prime, B, bct_a, bct_b, bct_c, fixed_rank);
29311 C.
add(C_prime, fixed_rank);
29315 mmult(C, B, bct_a, bct_b, bct_c, fixed_rank);
29320template <
int spacedim,
typename Number>
29325 const unsigned int fixed_rank,
29326 const bool is_result_matrix_store_tril_only)
29329 C, (*
this), B, fixed_rank, is_result_matrix_store_tril_only);
29333template <
int spacedim,
typename Number>
29337 const Number alpha,
29339 const unsigned int fixed_rank,
29340 const bool is_result_matrix_store_tril_only)
29343 C, alpha, (*
this), B, fixed_rank, is_result_matrix_store_tril_only);
29347template <
int spacedim,
typename Number>
29351 const Number alpha,
29353 const unsigned int fixed_rank,
29354 const bool is_result_matrix_store_tril_only)
29357 C, alpha, (*
this), B, fixed_rank, is_result_matrix_store_tril_only);
29361template <
int spacedim,
typename Number>
29366 const unsigned int fixed_rank,
29367 const bool is_result_matrix_store_tril_only)
29370 C, (*
this), B, fixed_rank, is_result_matrix_store_tril_only);
29374template <
int spacedim,
typename Number>
29378 const Number alpha,
29380 const unsigned int fixed_rank,
29381 const bool is_result_matrix_store_tril_only)
29384 C, alpha, (*
this), B, fixed_rank, is_result_matrix_store_tril_only);
29388template <
int spacedim,
typename Number>
29392 const Number alpha,
29394 const unsigned int fixed_rank,
29395 const bool is_result_matrix_store_tril_only)
29398 C, alpha, (*
this), B, fixed_rank, is_result_matrix_store_tril_only);
29402template <
int spacedim,
typename Number>
29407 const unsigned int fixed_rank,
29408 const bool is_result_matrix_store_tril_only)
29411 C, (*
this), B, fixed_rank, is_result_matrix_store_tril_only);
29415template <
int spacedim,
typename Number>
29419 const Number alpha,
29421 const unsigned int fixed_rank,
29422 const bool is_result_matrix_store_tril_only)
29425 C, alpha, (*
this), B, fixed_rank, is_result_matrix_store_tril_only);
29429template <
int spacedim,
typename Number>
29445 for (
size_type i = 0; i < submatrices.size(); i++)
29471 Assert(
false, ExcInvalidHMatrixType(type));
29477template <
int spacedim,
typename Number>
29494 for (
size_type i = 0; i < submatrices.size(); i++)
29521 Assert(
false, ExcInvalidHMatrixType(type));
29527template <
int spacedim,
typename Number>
29542 for (
size_type i = 0; i < submatrices.size(); i++)
29544 submatrices[i]->add(*(B.
submatrices[i]), fixed_rank_k);
29561 this->rkmatrix->add(*(B.
rkmatrix), fixed_rank_k);
29566 Assert(
false, ExcInvalidHMatrixType(type));
29572template <
int spacedim,
typename Number>
29588 for (
size_type i = 0; i < submatrices.size(); i++)
29590 submatrices[i]->add(b, *(B.
submatrices[i]), fixed_rank_k);
29607 this->rkmatrix->add(b, *(B.
rkmatrix), fixed_rank_k);
29612 Assert(
false, ExcInvalidHMatrixType(type));
29618template <
int spacedim,
typename Number>
29622 const std::array<types::global_dof_index, 2> &B_row_index_range,
29623 const std::array<types::global_dof_index, 2> &B_col_index_range,
29625 const bool is_result_matrix_store_tril_only)
const
29627 if (is_result_matrix_store_tril_only)
29634 Assert(this->property == HMatrixSupport::Property::symmetric ||
29635 this->property == HMatrixSupport::Property::hermite_symmetric ||
29636 this->property == HMatrixSupport::Property::lower_triangular,
29637 ExcInvalidHMatrixProperty(this->property));
29638 Assert(this->block_type == HMatrixSupport::BlockType::diagonal_block,
29639 ExcInvalidHMatrixBlockType(this->block_type));
29656 if (is_result_matrix_store_tril_only)
29658 for (
size_type i = 0; i < submatrices.size(); i++)
29660 if (submatrices[i]->block_type !=
29661 HMatrixSupport::BlockType::upper_triangular_block)
29663 submatrices[i]->add(
29668 submatrices[i]->property ==
29669 HMatrixSupport::Property::symmetric ||
29670 submatrices[i]->property ==
29671 HMatrixSupport::Property::hermite_symmetric ||
29672 submatrices[i]->property ==
29673 HMatrixSupport::Property::lower_triangular);
29679 for (
size_type i = 0; i < submatrices.size(); i++)
29681 submatrices[i]->add(B,
29706 fullmatrix_from_rk,
29707 *(row_index_range),
29708 *(col_index_range));
29717 fullmatrix_from_rk,
29718 is_result_matrix_store_tril_only);
29733 Assert(!is_result_matrix_store_tril_only, ExcInternalError());
29740 *(col_index_range),
29743 B_col_index_range);
29745 this->rkmatrix->add(rkmatrix_by_restriction, fixed_rank_k);
29750 Assert(
false, ExcInvalidHMatrixType(type));
29756template <
int spacedim,
typename Number>
29760 const std::array<types::global_dof_index, 2> &B_row_index_range,
29761 const std::array<types::global_dof_index, 2> &B_col_index_range,
29763 const bool is_result_matrix_store_tril_only)
29765 if (is_result_matrix_store_tril_only)
29771 Assert(this->property == HMatrixSupport::Property::symmetric ||
29772 this->property == HMatrixSupport::Property::lower_triangular,
29773 ExcInvalidHMatrixProperty(this->property));
29774 Assert(this->block_type == HMatrixSupport::BlockType::diagonal_block,
29775 ExcInvalidHMatrixBlockType(this->block_type));
29792 if (is_result_matrix_store_tril_only)
29794 for (
size_type i = 0; i < submatrices.size(); i++)
29796 if (submatrices[i]->block_type !=
29797 HMatrixSupport::BlockType::upper_triangular_block)
29805 submatrices[i]->add_for_parallel_lu_or_cholesky(
29810 submatrices[i]->property ==
29811 HMatrixSupport::Property::symmetric ||
29812 submatrices[i]->property ==
29813 HMatrixSupport::Property::lower_triangular);
29819 for (
size_type i = 0; i < submatrices.size(); i++)
29827 submatrices[i]->add_for_parallel_lu_or_cholesky(
29853 fullmatrix_from_rk,
29854 *(row_index_range),
29855 *(col_index_range));
29862 std::lock_guard<std::mutex> lg(update_lock);
29870 fullmatrix_from_rk,
29871 is_result_matrix_store_tril_only);
29887 Assert(!is_result_matrix_store_tril_only, ExcInternalError());
29894 *(col_index_range),
29897 B_col_index_range);
29904 std::lock_guard<std::mutex> lg(update_lock);
29906#if ARENA_OR_ISOLATE_IN_LU_AND_CHOL == 3
29907 this->rkmatrix->add(rkmatrix_by_restriction, fixed_rank_k);
29911#if ARENA_OR_ISOLATE_IN_LU_AND_CHOL == 1
29913 ta.execute([
this, &rkmatrix_by_restriction, fixed_rank_k] {
29914 this->rkmatrix->add(rkmatrix_by_restriction, fixed_rank_k);
29918#if ARENA_OR_ISOLATE_IN_LU_AND_CHOL == 2
29923 tbb::this_task_arena::isolate(
29924 [
this, &rkmatrix_by_restriction, fixed_rank_k] {
29925 this->rkmatrix->add(rkmatrix_by_restriction, fixed_rank_k);
29933 Assert(
false, ExcInvalidHMatrixType(type));
29939template <
int spacedim,
typename Number>
29944 const std::array<types::global_dof_index, 2> &B_row_index_range,
29945 const std::array<types::global_dof_index, 2> &B_col_index_range,
29947 const bool is_result_matrix_store_tril_only)
const
29949 if (is_result_matrix_store_tril_only)
29955 Assert(this->property == HMatrixSupport::Property::symmetric ||
29956 this->property == HMatrixSupport::Property::hermite_symmetric ||
29957 this->property == HMatrixSupport::Property::lower_triangular,
29958 ExcInvalidHMatrixProperty(this->property));
29959 Assert(this->block_type == HMatrixSupport::BlockType::diagonal_block,
29960 ExcInvalidHMatrixBlockType(this->block_type));
29972 if (is_result_matrix_store_tril_only)
29974 for (
size_type i = 0; i < submatrices.size(); i++)
29976 if (submatrices[i]->block_type !=
29977 HMatrixSupport::BlockType::upper_triangular_block)
29979 submatrices[i]->add(
29985 submatrices[i]->property ==
29986 HMatrixSupport::Property::symmetric ||
29987 submatrices[i]->property ==
29988 HMatrixSupport::Property::hermite_symmetric ||
29989 submatrices[i]->property ==
29990 HMatrixSupport::Property::lower_triangular);
29996 for (
size_type i = 0; i < submatrices.size(); i++)
29998 submatrices[i]->add(b,
30024 fullmatrix_from_rk,
30025 *(row_index_range),
30026 *(col_index_range));
30028 this->fullmatrix->add(b,
30030 fullmatrix_from_rk,
30031 is_result_matrix_store_tril_only);
30050 *(col_index_range),
30053 B_col_index_range);
30055 this->rkmatrix->add(b, rkmatrix_by_restriction, fixed_rank_k);
30060 Assert(
false, ExcInvalidHMatrixType(type));
30066template <
int spacedim,
typename Number>
30070 const bool is_result_matrix_store_tril_only)
30072 AssertDimension(m, B.
get_m());
30073 AssertDimension(n, B.
get_n());
30079 is_result_matrix_store_tril_only);
30083template <
int spacedim,
typename Number>
30088 const bool is_result_matrix_store_tril_only)
30090 AssertDimension(m, B.
get_m());
30091 AssertDimension(n, B.
get_n());
30093 this->add_for_parallel_lu_or_cholesky(B,
30097 is_result_matrix_store_tril_only);
30101template <
int spacedim,
typename Number>
30106 const bool is_result_matrix_store_tril_only)
30108 AssertDimension(m, B.
get_m());
30109 AssertDimension(n, B.
get_n());
30116 is_result_matrix_store_tril_only);
30120template <
int spacedim,
typename Number>
30124 if (E.m() != 0 && E.n() != 0)
30135 Assert(block_type == HMatrixSupport::BlockType::diagonal_block,
30137 "The current H-matrix node should be a diagonal block!"));
30149 this->fullmatrix->add(EEH);
30159 std::array<types::global_dof_index, 2> &t1_index_range =
30160 *(submatrices[0]->row_index_range);
30161 std::array<types::global_dof_index, 2> &t2_index_range =
30162 *(submatrices[3]->row_index_range);
30176 t1_index_range[0] - (*this->row_index_range)[0] + i,
30188 t2_index_range[0] - (*this->row_index_range)[0] + i,
30193 submatrices[0]->addsym_diag(E1);
30194 submatrices[3]->addsym_diag(E2);
30200template <
int spacedim,
typename Number>
30207 C.
add(B, fixed_rank_k);
30211template <
int spacedim,
typename Number>
30219 C.
add(b, B, fixed_rank_k);
30223template <
int spacedim,
typename Number>
30229 _invert_by_gauss_elim(M_inv, fixed_rank_k);
30235 link_hmat_nodes_on_same_levels();
30242template <
int spacedim,
typename Number>
30246 const bool is_unit_diagonal)
const
30251 AssertDimension(m, n);
30260 Assert(fullmatrix !=
nullptr, ExcInternalError());
30262 Vector<Number> local_b(n);
30269 local_b(j) = b((*col_index_range)[0] + j);
30278 fullmatrix->solve_by_forward_substitution(
30291 b((*row_index_range)[0] + i) = local_b(i);
30296 const unsigned int n_row_blocks = get_n_row_blocks();
30297 const unsigned int n_col_blocks = get_n_col_blocks();
30299 AssertDimension(n_row_blocks, n_col_blocks);
30304 for (
size_type i = 0; i < n_row_blocks; i++)
30312 submatrices[i * n_col_blocks + j]->vmult(
30313 b, real_type(-1.0), b, HMatrixSupport::Property::general);
30320 submatrices[i * n_col_blocks + i]->solve_by_forward_substitution(
30321 b, is_unit_diagonal);
30327template <
int spacedim,
typename Number>
30331 const Vector<Number> &b,
30332 const bool is_unit_diagonal)
const
30335 solve_by_forward_substitution(x, is_unit_diagonal);
30340template <
int spacedim,
typename Number>
30345 const bool is_unit_diagonal)
const
30350 AssertDimension(m, n);
30359 Assert(fullmatrix !=
nullptr, ExcInternalError());
30361 Vector<Number> local_b(n);
30378 fullmatrix->solve_by_forward_substitution(
30400 const unsigned int n_row_blocks = get_n_row_blocks();
30401 const unsigned int n_col_blocks = get_n_col_blocks();
30403 AssertDimension(n_row_blocks, n_col_blocks);
30405 for (
size_type i = 0; i < n_row_blocks; i++)
30413 submatrices[i * n_col_blocks + j]->vmult(
30418 HMatrixSupport::Property::general);
30425 submatrices[i * n_col_blocks + i]->solve_by_forward_substitution(
30426 b, starting_hmat, is_unit_diagonal);
30432template <
int spacedim,
typename Number>
30436 const Vector<Number> &b,
30438 const bool is_unit_diagonal)
const
30441 solve_by_forward_substitution(x, starting_hmat, is_unit_diagonal);
30445template <
int spacedim,
typename Number>
30450 const unsigned int fixed_rank,
30451 const bool is_unit_diagonal)
const
30453 AssertDimension(Z.
m, X.
m);
30454 AssertDimension(Z.
n, X.
n);
30458 "Matrix Z and X should be built on a same block cluster and thus they should have a same H-matrix type!"));
30459 AssertDimension(this->m, this->n);
30460 AssertDimension(this->n, X.
m);
30468 Vector<Number> X_col(X.
m);
30469 Vector<Number> Z_col(Z.
m);
30483 this->solve_by_forward_substitution(X_col,
30516 Vector<Number> A_prime_col(X.
m);
30519 Z.
rkmatrix->get_A().get_column(j, A_prime_col);
30521 this->solve_by_forward_substitution(A_prime_col,
30528 X.
rkmatrix->get_A().fill_col(j, A_prime_col);
30544 this->get_n_row_blocks(),
30545 this->bc_node->get_data_reference().get_sigma_node()->get_child_num());
30553 AssertDimension(this->get_n_row_blocks(), n_row_blocks);
30570 for (
size_type i = 0; i < n_row_blocks; i++)
30578 for (
size_type j = 0; j < n_col_blocks; j++)
30586 this->submatrices[i * n_row_blocks + k]
30587 ->mmult_level_conserving(
30598 this->submatrices[i * n_row_blocks + i]
30599 ->solve_by_forward_substitution_matrix_valued(
30610template <
int spacedim,
typename Number>
30614 const unsigned int fixed_rank,
30615 const bool is_unit_diagonal)
const
30617 AssertDimension(this->m, this->n);
30618 AssertDimension(this->n, Z.
m);
30626 Vector<Number> Z_col(Z.
m);
30640 this->solve_by_forward_substitution(Z_col, (*
this), is_unit_diagonal);
30667 Vector<Number> A_prime_col(Z.
m);
30670 Z.
rkmatrix->get_A().get_column(j, A_prime_col);
30672 this->solve_by_forward_substitution(A_prime_col,
30679 Z.
rkmatrix->get_A().fill_col(j, A_prime_col);
30695 this->get_n_row_blocks(),
30696 this->bc_node->get_data_reference().get_sigma_node()->get_child_num());
30704 AssertDimension(this->get_n_row_blocks(), n_row_blocks);
30714 for (
size_type i = 0; i < n_row_blocks; i++)
30722 for (
size_type j = 0; j < n_col_blocks; j++)
30730 this->submatrices[i * n_row_blocks + k]
30731 ->mmult_level_conserving(
30742 this->submatrices[i * n_row_blocks + i]
30743 ->solve_by_forward_substitution_matrix_valued(
30753template <
int spacedim,
typename Number>
30758 const unsigned int fixed_rank)
const
30760 solve_by_forward_substitution_matrix_valued(X, Z, fixed_rank,
false);
30764template <
int spacedim,
typename Number>
30768 const unsigned int fixed_rank)
const
30770 solve_by_forward_substitution_matrix_valued(Z, fixed_rank,
false);
30774template <
int spacedim,
typename Number>
30777 Vector<Number> &b)
const
30782 AssertDimension(m, n);
30792 Assert(fullmatrix !=
nullptr, ExcInternalError());
30794 Vector<Number> local_b(m);
30801 local_b(i) = b((*row_index_range)[0] + i);
30808 fullmatrix->solve_by_forward_substitution(local_b,
true,
false,
false);
30815 b((*col_index_range)[0] + j) = local_b(j);
30820 const unsigned int n_col_blocks = get_n_col_blocks();
30822 AssertDimension(get_n_row_blocks(), n_col_blocks);
30828 for (
size_type j = 0; j < n_col_blocks; j++)
30836 submatrices[i * n_col_blocks + j]->Tvmult(
30837 b, real_type(-1.0), b, HMatrixSupport::Property::general);
30844 submatrices[j * n_col_blocks + j]
30845 ->solve_transpose_by_forward_substitution(b);
30851template <
int spacedim,
typename Number>
30855 const Vector<Number> &b)
const
30858 solve_transpose_by_forward_substitution(x);
30862template <
int spacedim,
typename Number>
30871 AssertDimension(m, n);
30881 Assert(fullmatrix !=
nullptr, ExcInternalError());
30883 Vector<Number> local_b(m);
30898 fullmatrix->solve_by_forward_substitution(local_b,
true,
false,
false);
30911 const unsigned int n_col_blocks = get_n_col_blocks();
30913 AssertDimension(get_n_row_blocks(), n_col_blocks);
30919 for (
size_type j = 0; j < n_col_blocks; j++)
30927 submatrices[i * n_col_blocks + j]->Tvmult(
30932 HMatrixSupport::Property::general);
30939 submatrices[j * n_col_blocks + j]
30940 ->solve_transpose_by_forward_substitution(b, starting_hmat);
30946template <
int spacedim,
typename Number>
30950 const Vector<Number> &b,
30954 solve_transpose_by_forward_substitution(x, starting_hmat);
30958template <
int spacedim,
typename Number>
30964 const unsigned int fixed_rank)
const
30966 AssertDimension(Z.
m, X.
m);
30967 AssertDimension(Z.
n, X.
n);
30971 "Matrix Z and X should be built on a same block cluster and thus have a same H-matrix type!"));
30972 AssertDimension(this->m, this->n);
30973 AssertDimension(X.
n, this->m);
30981 Vector<Number> X_row(X.
n);
30982 Vector<Number> Z_row(Z.
n);
30997 this->solve_transpose_by_forward_substitution(X_row, Z_row, (*
this));
31013 Vector<Number> B_prime_col(X.
n);
31017 Z.
rkmatrix->get_B().get_column(j, B_prime_col);
31023 this->solve_transpose_by_forward_substitution(B_prime_col, (*
this));
31030 X.
rkmatrix->get_B().fill_col(j, B_prime_col);
31047 this->get_n_row_blocks(),
31048 this->bc_node->get_data_reference().get_sigma_node()->get_child_num());
31062 AssertDimension(this->get_n_row_blocks(), n_col_blocks);
31077 for (
size_type j = 0; j < n_col_blocks; j++)
31085 for (
size_type i = 0; i < n_row_blocks; i++)
31095 X.
submatrices[i * n_col_blocks + k]->mmult_level_conserving(
31098 *(this->submatrices[k * n_col_blocks + j]),
31106 this->submatrices[j * n_col_blocks + j]
31107 ->solve_transpose_by_forward_substitution_matrix_valued(
31117template <
int spacedim,
typename Number>
31122 const unsigned int fixed_rank)
const
31124 AssertDimension(this->m, this->n);
31125 AssertDimension(Z.
n, this->m);
31133 Vector<Number> Z_row(Z.
n);
31148 this->solve_transpose_by_forward_substitution(Z_row, (*
this));
31161 Vector<Number> B_col(Z.
n);
31165 Z.
rkmatrix->get_B().get_column(j, B_col);
31171 this->solve_transpose_by_forward_substitution(B_col, (*
this));
31176 Z.
rkmatrix->get_B().fill_col(j, B_col);
31193 this->get_n_row_blocks(),
31194 this->bc_node->get_data_reference().get_sigma_node()->get_child_num());
31206 AssertDimension(this->get_n_row_blocks(), n_col_blocks);
31212 for (
size_type j = 0; j < n_col_blocks; j++)
31220 for (
size_type i = 0; i < n_row_blocks; i++)
31230 Z.
submatrices[i * n_col_blocks + k]->mmult_level_conserving(
31233 *(this->submatrices[k * n_col_blocks + j]),
31241 this->submatrices[j * n_col_blocks + j]
31242 ->solve_transpose_by_forward_substitution_matrix_valued(
31243 *(Z.
submatrices[i * n_col_blocks + j]), fixed_rank);
31250template <
int spacedim,
typename Number>
31256 const unsigned int fixed_rank)
const
31258 AssertDimension(Z.
m, X.
m);
31259 AssertDimension(Z.
n, X.
n);
31263 "Matrix Z and X should be built on a same block cluster and thus have a same H-matrix type!"));
31264 AssertDimension(this->m, this->n);
31272 AssertDimension(X.
n, this->n);
31280 Vector<Number> X_row(X.
n);
31281 Vector<Number> Z_row(Z.
n);
31297 this->solve_by_forward_substitution(X_row, Z_row, (*
this),
false);
31310 Vector<Number> B_prime_col(X.
n);
31313 Z.
rkmatrix->get_B().get_column(j, B_prime_col);
31320 this->solve_by_forward_substitution(B_prime_col, (*
this),
false);
31325 X.
rkmatrix->get_B().fill_col(j, B_prime_col);
31341 this->get_n_row_blocks(),
31342 this->bc_node->get_data_reference().get_sigma_node()->get_child_num());
31356 AssertDimension(this->get_n_col_blocks(), n_col_blocks);
31370 for (
size_type j = 0; j < n_col_blocks; j++)
31378 for (
size_type i = 0; i < n_row_blocks; i++)
31393 X.
submatrices[i * n_col_blocks + k]->mTmult_level_conserving(
31396 *(this->submatrices[j * n_col_blocks + k]),
31405 this->submatrices[j * n_col_blocks + j]
31406 ->solve_cholesky_transpose_by_forward_substitution_matrix_valued(
31416template <
int spacedim,
typename Number>
31421 const unsigned int fixed_rank)
const
31423 AssertDimension(this->m, this->n);
31431 AssertDimension(Z.
n, this->n);
31439 Vector<Number> Z_row(Z.
n);
31455 this->solve_by_forward_substitution(Z_row, (*
this),
false);
31465 Vector<Number> B_col(Z.
n);
31468 Z.
rkmatrix->get_B().get_column(j, B_col);
31475 this->solve_by_forward_substitution(B_col, (*
this),
false);
31480 Z.
rkmatrix->get_B().fill_col(j, B_col);
31496 this->get_n_row_blocks(),
31497 this->bc_node->get_data_reference().get_sigma_node()->get_child_num());
31509 AssertDimension(this->get_n_col_blocks(), n_col_blocks);
31515 for (
size_type j = 0; j < n_col_blocks; j++)
31522 for (
size_type i = 0; i < n_row_blocks; i++)
31537 Z.
submatrices[i * n_col_blocks + k]->mTmult_level_conserving(
31540 *(this->submatrices[j * n_col_blocks + k]),
31549 this->submatrices[j * n_col_blocks + j]
31550 ->solve_cholesky_transpose_by_forward_substitution_matrix_valued(
31551 *(Z.
submatrices[i * n_col_blocks + j]), fixed_rank);
31558template <
int spacedim,
typename Number>
31562 const bool is_unit_block_diagonal)
const
31567 AssertDimension(m, n);
31576 Assert(fullmatrix !=
nullptr, ExcInternalError());
31578 if (is_unit_block_diagonal)
31593 Vector<Number> local_b(n);
31601 local_b(j) = b((*col_index_range)[0] + j);
31607 fullmatrix->compute_lu_factorization();
31608 fullmatrix->solve(local_b);
31616 b((*row_index_range)[0] + i) = local_b(i);
31625 const unsigned int n_row_blocks = get_n_row_blocks();
31626 const unsigned int n_col_blocks = get_n_col_blocks();
31628 AssertDimension(n_row_blocks, n_col_blocks);
31630 for (
size_type i = 0; i < n_row_blocks; i++)
31638 submatrices[i * n_col_blocks + j]->vmult(
31639 b, real_type(-1.0), b, HMatrixSupport::Property::general);
31646 submatrices[i * n_col_blocks + i]
31647 ->solve_block_triangular_by_forward_substitution(
31648 b, is_unit_block_diagonal);
31654template <
int spacedim,
typename Number>
31658 const Vector<Number> &b,
31659 const bool is_unit_block_diagonal)
const
31662 solve_block_triangular_by_forward_substitution(x, is_unit_block_diagonal);
31666template <
int spacedim,
typename Number>
31671 const bool is_unit_block_diagonal)
const
31676 AssertDimension(m, n);
31685 Assert(fullmatrix !=
nullptr, ExcInternalError());
31687 if (is_unit_block_diagonal)
31702 Vector<Number> local_b(n);
31710 local_b(j) = b((*col_index_range)[0] -
31717 fullmatrix->compute_lu_factorization();
31718 fullmatrix->solve(local_b);
31736 const unsigned int n_row_blocks = get_n_row_blocks();
31737 const unsigned int n_col_blocks = get_n_col_blocks();
31739 AssertDimension(n_row_blocks, n_col_blocks);
31741 for (
size_type i = 0; i < n_row_blocks; i++)
31749 submatrices[i * n_col_blocks + j]->vmult(
31754 HMatrixSupport::Property::general);
31761 submatrices[i * n_col_blocks + i]
31762 ->solve_block_triangular_by_forward_substitution(
31763 b, starting_hmat, is_unit_block_diagonal);
31769template <
int spacedim,
typename Number>
31773 const Vector<Number> &b,
31775 const bool is_unit_block_diagonal)
const
31778 solve_block_triangular_by_forward_substitution(x,
31780 is_unit_block_diagonal);
31784template <
int spacedim,
typename Number>
31787 Vector<Number> &b)
const
31789 Assert(state == HMatrixSupport::cholesky, ExcInvalidHMatrixState(state));
31791 solve_by_forward_substitution(b,
false);
31795template <
int spacedim,
typename Number>
31799 const Vector<Number> &b)
const
31801 Assert(state == HMatrixSupport::cholesky, ExcInvalidHMatrixState(state));
31803 solve_by_forward_substitution(x, b,
false);
31807template <
int spacedim,
typename Number>
31813 Assert(state == HMatrixSupport::cholesky, ExcInvalidHMatrixState(state));
31815 solve_by_forward_substitution(b, starting_hmat,
false);
31819template <
int spacedim,
typename Number>
31823 const Vector<Number> &b,
31826 Assert(state == HMatrixSupport::cholesky, ExcInvalidHMatrixState(state));
31828 solve_by_forward_substitution(x, b, starting_hmat,
false);
31832template <
int spacedim,
typename Number>
31836 const bool is_unit_diagonal)
const
31841 AssertDimension(m, n);
31850 Assert(fullmatrix !=
nullptr, ExcInternalError());
31852 Vector<Number> local_b(n);
31859 local_b(j) = b((*col_index_range)[0] + j);
31865 fullmatrix->solve_by_backward_substitution(local_b,
31874 b((*row_index_range)[0] + i) = local_b(i);
31882 const unsigned int n_row_blocks = get_n_row_blocks();
31883 const unsigned int n_col_blocks = get_n_col_blocks();
31885 AssertDimension(n_row_blocks, n_col_blocks);
31893 for (
int i = n_row_blocks - 1; i >= 0; i--)
31899 for (
size_type j = i + 1; j < n_col_blocks; j++)
31901 submatrices[i * n_col_blocks + j]->vmult(
31902 b, real_type(-1.0), b, HMatrixSupport::Property::general);
31909 submatrices[i * n_col_blocks + i]->solve_by_backward_substitution(
31910 b, is_unit_diagonal);
31916template <
int spacedim,
typename Number>
31920 const Vector<Number> &b,
31921 const bool is_unit_diagonal)
const
31924 solve_by_backward_substitution(x, is_unit_diagonal);
31928template <
int spacedim,
typename Number>
31933 const bool is_unit_diagonal)
const
31938 AssertDimension(m, n);
31947 Assert(fullmatrix !=
nullptr, ExcInternalError());
31949 Vector<Number> local_b(n);
31963 fullmatrix->solve_by_backward_substitution(local_b,
31981 const unsigned int n_row_blocks = get_n_row_blocks();
31982 const unsigned int n_col_blocks = get_n_col_blocks();
31984 AssertDimension(n_row_blocks, n_col_blocks);
31992 for (
int i = n_row_blocks - 1; i >= 0; i--)
31998 for (
size_type j = i + 1; j < n_col_blocks; j++)
32000 submatrices[i * n_col_blocks + j]->vmult(
32005 HMatrixSupport::Property::general);
32011 submatrices[i * n_col_blocks + i]->solve_by_backward_substitution(
32012 b, starting_hmat, is_unit_diagonal);
32018template <
int spacedim,
typename Number>
32022 const Vector<Number> &b,
32024 const bool is_unit_diagonal)
const
32027 solve_by_backward_substitution(x, starting_hmat, is_unit_diagonal);
32031template <
int spacedim,
typename Number>
32035 const bool is_unit_block_diagonal)
const
32040 AssertDimension(m, n);
32049 Assert(fullmatrix !=
nullptr, ExcInternalError());
32051 if (is_unit_block_diagonal)
32066 Vector<Number> local_b(n);
32074 local_b(j) = b((*col_index_range)[0] + j);
32080 fullmatrix->compute_lu_factorization();
32081 fullmatrix->solve(local_b);
32089 b((*row_index_range)[0] + i) = local_b(i);
32098 const unsigned int n_row_blocks = get_n_row_blocks();
32099 const unsigned int n_col_blocks = get_n_col_blocks();
32101 AssertDimension(n_row_blocks, n_col_blocks);
32109 for (
int i = n_row_blocks - 1; i >= 0; i--)
32115 for (
size_type j = i + 1; j < n_col_blocks; j++)
32117 submatrices[i * n_col_blocks + j]->vmult(
32118 b, real_type(-1.0), b, HMatrixSupport::Property::general);
32124 submatrices[i * n_col_blocks + i]
32125 ->solve_block_triangular_by_backward_substitution(
32126 b, is_unit_block_diagonal);
32132template <
int spacedim,
typename Number>
32136 const Vector<Number> &b,
32137 const bool is_unit_block_diagonal)
const
32140 solve_block_triangular_by_backward_substitution(x, is_unit_block_diagonal);
32144template <
int spacedim,
typename Number>
32149 const bool is_unit_block_diagonal)
const
32154 AssertDimension(m, n);
32163 Assert(fullmatrix !=
nullptr, ExcInternalError());
32165 if (is_unit_block_diagonal)
32180 Vector<Number> local_b(n);
32188 local_b(j) = b((*col_index_range)[0] -
32195 fullmatrix->compute_lu_factorization();
32196 fullmatrix->solve(local_b);
32214 const unsigned int n_row_blocks = get_n_row_blocks();
32215 const unsigned int n_col_blocks = get_n_col_blocks();
32217 AssertDimension(n_row_blocks, n_col_blocks);
32225 for (
int i = n_row_blocks - 1; i >= 0; i--)
32231 for (
size_type j = i + 1; j < n_col_blocks; j++)
32233 submatrices[i * n_col_blocks + j]->vmult(
32238 HMatrixSupport::Property::general);
32244 submatrices[i * n_col_blocks + i]
32245 ->solve_block_triangular_by_backward_substitution(
32246 b, starting_hmat, is_unit_block_diagonal);
32252template <
int spacedim,
typename Number>
32256 const Vector<Number> &b,
32258 const bool is_unit_block_diagonal)
const
32261 solve_block_triangular_by_backward_substitution(x,
32263 is_unit_block_diagonal);
32267template <
int spacedim,
typename Number>
32270 Vector<Number> &b)
const
32272 Assert(state == HMatrixSupport::cholesky, ExcInvalidHMatrixState(state));
32277 AssertDimension(m, n);
32286 Assert(fullmatrix !=
nullptr, ExcInternalError());
32288 Vector<Number> local_b(m);
32297 local_b(i) = b((*row_index_range)[0] + i);
32306 fullmatrix->solve_by_backward_substitution(local_b,
32316 b((*col_index_range)[0] + j) = local_b(j);
32321 const unsigned int n_row_blocks = get_n_row_blocks();
32322 const unsigned int n_col_blocks = get_n_col_blocks();
32324 AssertDimension(n_row_blocks, n_col_blocks);
32329 for (
int j = n_col_blocks - 1; j >= 0; j--)
32335 for (
size_type i = j + 1; i < n_row_blocks; i++)
32341 submatrices[i * n_col_blocks + j]->Tvmult(
32342 b, real_type(-1.0), b, HMatrixSupport::Property::general);
32349 submatrices[j * n_col_blocks + j]
32350 ->solve_cholesky_by_backward_substitution(b);
32356template <
int spacedim,
typename Number>
32360 const Vector<Number> &b)
const
32363 solve_cholesky_by_backward_substitution(x);
32367template <
int spacedim,
typename Number>
32376 AssertDimension(m, n);
32385 Assert(fullmatrix !=
nullptr, ExcInternalError());
32387 Vector<Number> local_b(m);
32404 fullmatrix->solve_by_backward_substitution(local_b,
32420 const unsigned int n_row_blocks = get_n_row_blocks();
32421 const unsigned int n_col_blocks = get_n_col_blocks();
32423 AssertDimension(n_row_blocks, n_col_blocks);
32428 for (
int j = n_col_blocks - 1; j >= 0; j--)
32434 for (
size_type i = j + 1; i < n_row_blocks; i++)
32440 submatrices[i * n_col_blocks + j]->Tvmult(
32445 HMatrixSupport::Property::general);
32452 submatrices[j * n_col_blocks + j]
32453 ->solve_cholesky_by_backward_substitution(b, starting_hmat);
32459template <
int spacedim,
typename Number>
32463 const Vector<Number> &b,
32467 solve_cholesky_by_backward_substitution(x, starting_hmat);
32471template <
int spacedim,
typename Number>
32475 const unsigned int fixed_rank)
32477 this->_compute_lu_factorization(LU, fixed_rank);
32484 this->set_state(HMatrixSupport::unusable);
32488template <
int spacedim,
typename Number>
32491 const unsigned int fixed_rank)
32493 this->_compute_lu_factorization(fixed_rank);
32498 this->set_state(HMatrixSupport::lu);
32502template <
int spacedim,
typename Number>
32506 const unsigned int fixed_rank)
const
32519 Assert(fullmatrix !=
nullptr, ExcInternalError());
32520 Assert(LU.
fullmatrix !=
nullptr, ExcInternalError());
32535 const unsigned int n_row_blocks = get_n_row_blocks();
32536 const unsigned int n_col_blocks = get_n_col_blocks();
32542 AssertDimension(n_row_blocks, n_col_blocks);
32548 for (
size_type i = 0; i < n_row_blocks; i++)
32553 for (
size_type j = 0; j < n_col_blocks; j++)
32562 const size_type min_ij = std::min(i, j);
32570 LU.
submatrices[i * n_col_blocks + k]->mmult_level_conserving(
32586 ->solve_transpose_by_forward_substitution_matrix_valued(
32587 *(LU.
submatrices[i * n_col_blocks + j]), Z, fixed_rank);
32596 *(LU.
submatrices[i * n_col_blocks + i]), fixed_rank);
32604 ->solve_by_forward_substitution_matrix_valued(
32605 *(LU.
submatrices[i * n_col_blocks + j]), Z, fixed_rank);
32613template <
int spacedim,
typename Number>
32616 const unsigned int fixed_rank)
32629 Assert(fullmatrix !=
nullptr, ExcInternalError());
32635 fullmatrix->compute_lu_factorization();
32639 const unsigned int n_row_blocks = get_n_row_blocks();
32640 const unsigned int n_col_blocks = get_n_col_blocks();
32646 AssertDimension(n_row_blocks, n_col_blocks);
32652 for (
size_type i = 0; i < n_row_blocks; i++)
32657 for (
size_type j = 0; j < n_col_blocks; j++)
32666 const size_type min_ij = std::min(i, j);
32670 submatrices[i * n_col_blocks + k]->mmult_level_conserving(
32671 *(submatrices[i * n_col_blocks + j]),
32673 *(submatrices[k * n_col_blocks + j]),
32685 submatrices[j * n_col_blocks + j]
32686 ->solve_transpose_by_forward_substitution_matrix_valued(
32687 *(submatrices[i * n_col_blocks + j]), fixed_rank);
32695 submatrices[i * n_col_blocks + i]->_compute_lu_factorization(
32703 submatrices[i * n_col_blocks + i]
32704 ->solve_by_forward_substitution_matrix_valued(
32705 *(submatrices[i * n_col_blocks + j]), fixed_rank);
32713template <
int spacedim,
typename Number>
32716 const unsigned int fixed_rank)
32719 const int blas_num_threads = openblas_get_num_threads();
32720 openblas_set_num_threads(1);
32722#if ENABLE_DEBUG == 1 && ENABLE_TIMER == 1
32728 this->link_hmat_nodes_on_cross_from_diagonal_blocks(this->property);
32729#if ENABLE_DEBUG == 1 && ENABLE_TIMER == 1
32737 std::mutex log_stream_lock;
32742 tbb::flow::graph dag;
32744#if ENABLE_DEBUG == 1 && ENABLE_TIMER == 1
32747 compute_lu_dag(dag, fixed_rank, log_stream_lock);
32748#if ENABLE_DEBUG == 1 && ENABLE_TIMER == 1
32753#if ENABLE_DEBUG == 1 && ENABLE_TIMER == 1
32756 lu_assign_update_to_solve_and_factorize_dependencies();
32757#if ENABLE_DEBUG == 1 && ENABLE_TIMER == 1
32767 Assert(top_left_node !=
nullptr, ExcInternalError());
32769 ExcInternalError());
32771#if ENABLE_DEBUG == 1 && ENABLE_TIMER == 1
32775 tbb::flow::continue_msg());
32777 dag.wait_for_all();
32778#if ENABLE_DEBUG == 1 && ENABLE_TIMER == 1
32782 clear_lu_or_cholesky_task_nodes();
32787 this->set_state(HMatrixSupport::lu);
32790 openblas_set_num_threads(blas_num_threads);
32794template <
int spacedim,
typename Number>
32797 const unsigned int fixed_rank,
32798 std::mutex &log_stream_lock)
32800 const unsigned int n_row_blocks = get_n_row_blocks();
32801 const unsigned int n_col_blocks = get_n_col_blocks();
32807 AssertDimension(n_row_blocks, n_col_blocks);
32812 for (
size_type i = 0; i < n_row_blocks; i++)
32817 submatrices[i * n_col_blocks + i];
32818 const bool is_diag_block_leaf = current_diag_block->
is_leaf();
32820 current_diag_block->
compute_lu_dag(dag, fixed_rank, log_stream_lock);
32831 current_diag_column_block !=
nullptr;
32832 current_diag_column_block =
32833 current_diag_column_block->next_same_level_same_column_hmat_node)
32835 if (is_diag_block_leaf || current_diag_column_block->is_leaf())
32843 dag, *current_diag_column_block, fixed_rank, log_stream_lock);
32850#if ENABLE_DEBUG == 1 && MESSAGE_LEVEL >= 2
32851 std::cout <<
"factorize-to-solve-upper at level "
32852 << current_diag_block->
bc_node->get_level() <<
": ["
32858 << (*current_diag_column_block->row_index_range)[0]
32860 << (*current_diag_column_block->row_index_range)[1]
32862 << (*current_diag_column_block->col_index_range)[0]
32864 << (*current_diag_column_block->col_index_range)[1]
32865 <<
")" << std::endl;
32867 tbb::flow::make_edge(
32869 *(current_diag_column_block
32870 ->solve_upper_or_lower_lu_or_cholesky_graph_node));
32881 current_diag_row_block !=
nullptr;
32882 current_diag_row_block =
32883 current_diag_row_block->next_same_level_same_row_hmat_node)
32885 if (is_diag_block_leaf || current_diag_row_block->is_leaf())
32893 *current_diag_row_block,
32902#if ENABLE_DEBUG == 1 && MESSAGE_LEVEL >= 2
32903 std::cout <<
"factorize-to-solve-lower at level "
32904 << current_diag_block->
bc_node->get_level() <<
": ["
32910 << (*current_diag_row_block->row_index_range)[0] <<
","
32911 << (*current_diag_row_block->row_index_range)[1]
32913 << (*current_diag_row_block->col_index_range)[0] <<
","
32914 << (*current_diag_row_block->col_index_range)[1] <<
")"
32917 tbb::flow::make_edge(
32919 *(current_diag_row_block
32920 ->solve_upper_or_lower_lu_or_cholesky_graph_node));
32931 current_trailing_block =
32933 *current_diag_row_block =
32935 *current_diag_column_block =
32937 current_trailing_block !=
nullptr;
32938 current_trailing_block =
32939 current_trailing_block->next_same_level_hmat_node)
32945 if ((*current_trailing_block->row_index_range)[0] >=
32947 (*current_trailing_block->col_index_range)[0] >=
32950 bool is_diag_row_block_found =
false;
32951 bool is_diag_column_block_found =
false;
32957 while (current_diag_row_block !=
nullptr &&
32958 current_diag_row_block != current_diag_block)
32960 if (*current_diag_row_block->col_index_range ==
32961 *current_trailing_block->col_index_range)
32966 is_diag_row_block_found =
true;
32970 else if ((*current_trailing_block->col_index_range)[0] >=
32971 (*current_diag_row_block->col_index_range)[1])
32976 current_diag_row_block =
32977 current_diag_row_block
32978 ->next_same_level_same_row_hmat_node;
32980 if (current_diag_row_block !=
nullptr &&
32981 (*current_diag_row_block->col_index_range)[0] >=
32982 (*current_trailing_block->col_index_range)[1])
32993 else if ((*current_diag_row_block->col_index_range)[0] >=
32994 (*current_trailing_block->col_index_range)[1])
32999 current_diag_row_block =
33000 current_diag_row_block
33001 ->previous_same_level_same_row_hmat_node;
33003 if (current_diag_row_block !=
nullptr &&
33004 current_diag_row_block != current_diag_block &&
33005 (*current_trailing_block->col_index_range)[0] >=
33006 (*current_diag_row_block->col_index_range)[1])
33019 if (is_diag_row_block_found)
33025 while (current_diag_column_block !=
nullptr &&
33026 current_diag_column_block != current_diag_block)
33028 if (*current_diag_column_block->row_index_range ==
33029 *current_trailing_block->row_index_range)
33034 is_diag_column_block_found =
true;
33038 else if ((*current_trailing_block->row_index_range)[0] >=
33039 (*current_diag_column_block->row_index_range)[1])
33044 current_diag_column_block =
33045 current_diag_column_block
33046 ->next_same_level_same_column_hmat_node;
33048 if (current_diag_column_block !=
nullptr &&
33049 (*current_diag_column_block
33050 ->row_index_range)[0] >=
33051 (*current_trailing_block->row_index_range)[1])
33063 else if ((*current_diag_column_block
33064 ->row_index_range)[0] >=
33065 (*current_trailing_block->row_index_range)[1])
33070 current_diag_column_block =
33071 current_diag_column_block
33072 ->previous_same_level_same_column_hmat_node;
33074 if (current_diag_column_block !=
nullptr &&
33075 current_diag_column_block != current_diag_block &&
33076 (*current_trailing_block->row_index_range)[0] >=
33077 (*current_diag_column_block
33078 ->row_index_range)[1])
33092 if (!is_diag_column_block_found)
33099 if (current_diag_column_block ==
nullptr ||
33100 current_diag_column_block == current_diag_block)
33102 current_diag_column_block =
33115 if (current_diag_row_block ==
nullptr ||
33116 current_diag_row_block == current_diag_block)
33118 current_diag_row_block =
33127 if (is_diag_row_block_found && is_diag_column_block_found)
33129 if (current_trailing_block->is_leaf() ||
33130 current_diag_row_block->is_leaf() ||
33131 current_diag_column_block->is_leaf())
33137 current_trailing_block->lu_update_task(
33139 *current_diag_block,
33140 *current_diag_column_block,
33141 *current_diag_row_block,
33150 current_diag_row_block
33151 ->lu_build_solve_lower_to_update_dependencies(
33152 *current_trailing_block);
33159 current_diag_column_block
33160 ->lu_or_cholesky_build_solve_upper_to_update_dependencies(
33161 *current_trailing_block);
33170template <
int spacedim,
typename Number>
33173 tbb::flow::graph &dag,
33174 std::mutex &log_stream_lock)
33179 Assert(block_type == HMatrixSupport::BlockType::diagonal_block,
33180 ExcInvalidHMatrixBlockType(block_type));
33182 this->factorize_lu_or_cholesky_graph_node = std::make_shared<TaskNode>(
33183 dag, [
this, &log_stream_lock](
const tbb::flow::continue_msg &msg) {
33184#if ENABLE_DEBUG == 1 && MESSAGE_LEVEL >= 3
33186 std::lock_guard<std::mutex> lg(log_stream_lock);
33188 std::cout << std::this_thread::get_id() <<
"#lu_factorize: ["
33189 << (*this->row_index_range)[0] <<
","
33190 << (*this->row_index_range)[1] <<
"), ["
33191 << (*this->col_index_range)[0] <<
","
33192 << (*this->col_index_range)[1] <<
")" << std::endl;
33196 if (this->is_leaf())
33207 ExcInvalidHMatrixType(this->type));
33208 Assert(this->fullmatrix !=
nullptr, ExcInternalError());
33214 this->fullmatrix->compute_lu_factorization();
33222template <
int spacedim,
typename Number>
33226 const unsigned int fixed_rank,
33227 std::mutex &log_stream_lock)
33232 Assert(block_type == HMatrixSupport::BlockType::diagonal_block,
33233 ExcInvalidHMatrixBlockType(block_type));
33234 Assert(Z.
block_type != HMatrixSupport::BlockType::diagonal_block,
33245 [
this, &Z, fixed_rank, &log_stream_lock](
33246 const tbb::flow::continue_msg &msg) {
33247#if ENABLE_DEBUG == 1 && MESSAGE_LEVEL >= 3
33249 std::lock_guard<std::mutex> lg(log_stream_lock);
33251 std::cout << std::this_thread::get_id() <<
"#lu_solve_upper: ["
33258 this->solve_transpose_by_forward_substitution_matrix_valued(Z,
33265template <
int spacedim,
typename Number>
33269 const unsigned int fixed_rank,
33270 std::mutex &log_stream_lock)
33275 Assert(block_type == HMatrixSupport::BlockType::diagonal_block,
33276 ExcInvalidHMatrixBlockType(block_type));
33277 Assert(Z.
block_type != HMatrixSupport::BlockType::diagonal_block,
33288 [
this, &Z, fixed_rank, &log_stream_lock](
33289 const tbb::flow::continue_msg &msg) {
33290#if ENABLE_DEBUG == 1 && MESSAGE_LEVEL >= 3
33292 std::lock_guard<std::mutex> lg(log_stream_lock);
33294 std::cout << std::this_thread::get_id() <<
"#lu_solve_lower: ["
33301 this->solve_by_forward_substitution_matrix_valued(Z, fixed_rank);
33307template <
int spacedim,
typename Number>
33310 tbb::flow::graph &dag,
33314 const unsigned int fixed_rank,
33315 std::mutex &log_stream_lock)
33317 this->update_lu_or_cholesky_graph_nodes.push_back(
33320 std::make_shared<TaskNode>(
33323 &diag_column_block,
33326 &log_stream_lock](
const tbb::flow::continue_msg &msg) {
33327#if ENABLE_DEBUG == 1 && MESSAGE_LEVEL >= 3
33329 std::lock_guard<std::mutex> lg(log_stream_lock);
33331 std::cout << std::this_thread::get_id() <<
"#lu_update: ["
33340 <<
" --> [" << (*this->row_index_range)[0] <<
","
33341 << (*this->row_index_range)[1] <<
"), ["
33342 << (*this->col_index_range)[0] <<
","
33343 << (*this->col_index_range)[1] <<
")" << std::endl;
33347 diag_column_block.mmult_level_conserving_for_parallel_lu(
33348 *
this, -1.0, diag_row_block, fixed_rank);
33355template <
int spacedim,
typename Number>
33365 if (solve_upper_or_lower_lu_or_cholesky_graph_node)
33367#if ENABLE_DEBUG == 1 && MESSAGE_LEVEL >= 2
33368 std::cout <<
"solve-upper-to-update at level ("
33369 << this->bc_node->get_level() <<
","
33370 << update_block.
bc_node->get_level() <<
"): ["
33371 << (*this->row_index_range)[0] <<
","
33372 << (*this->row_index_range)[1] <<
"), ["
33373 << (*this->col_index_range)[0] <<
","
33374 << (*this->col_index_range)[1] <<
") --> ["
33381 tbb::flow::make_edge(
33382 *solve_upper_or_lower_lu_or_cholesky_graph_node,
33389 for (
auto submatrix : submatrices)
33391 submatrix->lu_or_cholesky_build_solve_upper_to_update_dependencies(
33397template <
int spacedim,
typename Number>
33406 if (solve_upper_or_lower_lu_or_cholesky_graph_node)
33408#if ENABLE_DEBUG == 1 && MESSAGE_LEVEL >= 2
33409 std::cout <<
"solve-lower-to-update at level ("
33410 << this->bc_node->get_level() <<
","
33411 << update_block.
bc_node->get_level() <<
"): ["
33412 << (*this->row_index_range)[0] <<
","
33413 << (*this->row_index_range)[1] <<
"), ["
33414 << (*this->col_index_range)[0] <<
","
33415 << (*this->col_index_range)[1] <<
") --> ["
33422 tbb::flow::make_edge(
33423 *solve_upper_or_lower_lu_or_cholesky_graph_node,
33430 for (
auto submatrix : submatrices)
33432 submatrix->lu_build_solve_lower_to_update_dependencies(update_block);
33437template <
int spacedim,
typename Number>
33442 for (
auto &update_node : update_lu_or_cholesky_graph_nodes)
33444#if ENABLE_DEBUG == 1 && MESSAGE_LEVEL >= 2
33445 std::cout <<
"update-to-factorize at level ("
33446 << this->bc_node->get_level() <<
","
33447 << factorize_block.
bc_node->get_level() <<
"): ["
33448 << (*this->row_index_range)[0] <<
","
33449 << (*this->row_index_range)[1] <<
"), ["
33450 << (*this->col_index_range)[0] <<
","
33451 << (*this->col_index_range)[1] <<
") --> ["
33458 tbb::flow::make_edge(
33459 *update_node.update,
33466 for (
auto submatrix : submatrices)
33468 submatrix->lu_build_update_to_factorize_dependencies(factorize_block);
33473template <
int spacedim,
typename Number>
33478 Assert(block_type == HMatrixSupport::BlockType::upper_triangular_block ||
33479 block_type == HMatrixSupport::BlockType::lower_triangular_block,
33480 ExcInternalError());
33482 for (
auto &update_node : update_lu_or_cholesky_graph_nodes)
33484#if ENABLE_DEBUG == 1 && MESSAGE_LEVEL >= 2
33485 if (solve_upper_or_lower_block.
block_type ==
33486 HMatrixSupport::BlockType::upper_triangular_block)
33488 std::cout <<
"update-to-solve-lower at level ("
33489 << this->bc_node->get_level() <<
","
33490 << solve_upper_or_lower_block.
bc_node->get_level() <<
"): ["
33491 << (*update_node.diagonal_hmat_node->row_index_range)[0]
33493 << (*update_node.diagonal_hmat_node->row_index_range)[1]
33495 << (*update_node.diagonal_hmat_node->col_index_range)[0]
33497 << (*update_node.diagonal_hmat_node->col_index_range)[1]
33506 else if (solve_upper_or_lower_block.
block_type ==
33507 HMatrixSupport::BlockType::lower_triangular_block)
33509 std::cout <<
"update-to-solve-upper at level ("
33510 << this->bc_node->get_level() <<
","
33511 << solve_upper_or_lower_block.
bc_node->get_level() <<
"): ["
33512 << (*update_node.diagonal_hmat_node->row_index_range)[0]
33514 << (*update_node.diagonal_hmat_node->row_index_range)[1]
33516 << (*update_node.diagonal_hmat_node->col_index_range)[0]
33518 << (*update_node.diagonal_hmat_node->col_index_range)[1]
33529 Assert(
false, ExcInternalError());
33533 tbb::flow::make_edge(*update_node.update,
33534 *solve_upper_or_lower_block
33541 for (
auto submatrix : submatrices)
33543 submatrix->lu_build_update_to_solve_upper_or_lower_dependencies(
33544 solve_upper_or_lower_block);
33549template <
int spacedim,
typename Number>
33552 Number>::lu_assign_update_to_solve_and_factorize_dependencies()
33554 if (solve_upper_or_lower_lu_or_cholesky_graph_node)
33560 lu_build_update_to_solve_upper_or_lower_dependencies(*
this);
33570 if (block_type == HMatrixSupport::BlockType::diagonal_block)
33577 if (factorize_lu_or_cholesky_graph_node)
33579 lu_build_update_to_factorize_dependencies(*
this);
33587 if (parent !=
nullptr &&
33588 parent->factorize_lu_or_cholesky_graph_node &&
33593 submatrix_index == (parent->get_n_row_blocks() - 1) *
33594 (parent->get_n_col_blocks() + 1))
33596#if ENABLE_DEBUG == 1 && MESSAGE_LEVEL >= 2
33597 std::cout <<
"factorize-to-factorize at level ("
33598 << this->bc_node->get_level() <<
","
33599 << parent->bc_node->get_level() <<
"): ["
33600 << (*this->row_index_range)[0] <<
","
33601 << (*this->row_index_range)[1] <<
"), ["
33602 << (*this->col_index_range)[0] <<
","
33603 << (*this->col_index_range)[1] <<
") --> ["
33604 << (*parent->row_index_range)[0] <<
","
33605 << (*parent->row_index_range)[1] <<
"), ["
33606 << (*parent->col_index_range)[0] <<
","
33607 << (*parent->col_index_range)[1] <<
")"
33611 tbb::flow::make_edge(
33612 *factorize_lu_or_cholesky_graph_node,
33613 *parent->factorize_lu_or_cholesky_graph_node);
33623 for (
auto submatrix : submatrices)
33628 if (update_lu_or_cholesky_graph_nodes.size() > 0)
33630 submatrix->update_lu_or_cholesky_graph_nodes.insert(
33631 submatrix->update_lu_or_cholesky_graph_nodes.end(),
33632 update_lu_or_cholesky_graph_nodes.begin(),
33633 update_lu_or_cholesky_graph_nodes.end());
33636 submatrix->lu_assign_update_to_solve_and_factorize_dependencies();
33642template <
int spacedim,
typename Number>
33646 const unsigned int fixed_rank)
const
33648 Assert(this->state == HMatrixSupport::State::matrix,
33649 ExcInvalidHMatrixState(this->state));
33650 Assert(this->property == HMatrixSupport::Property::symmetric,
33651 ExcInvalidHMatrixProperty(this->property));
33652 Assert(this->block_type == HMatrixSupport::BlockType::diagonal_block,
33653 ExcInvalidHMatrixBlockType(this->block_type));
33655 Assert(L.
state == HMatrixSupport::State::matrix,
33656 ExcInvalidHMatrixState(L.
state));
33657 Assert(L.
property == HMatrixSupport::Property::lower_triangular ||
33658 L.
property == HMatrixSupport::Property::symmetric,
33659 ExcInvalidHMatrixProperty(L.
property));
33660 Assert(L.
block_type == HMatrixSupport::BlockType::diagonal_block,
33674 Assert(fullmatrix !=
nullptr, ExcInternalError());
33675 Assert(L.
fullmatrix !=
nullptr, ExcInternalError());
33689 Assert(L.
fullmatrix->get_property() == LAPACKSupport::Property::symmetric,
33690 ExcInvalidLAPACKFullMatrixProperty(L.
fullmatrix->get_property()));
33696 L.
fullmatrix->compute_cholesky_factorization();
33700 const unsigned int n_row_blocks = get_n_row_blocks();
33701 const unsigned int n_col_blocks = get_n_col_blocks();
33707 AssertDimension(n_row_blocks, n_col_blocks);
33713 for (
size_type i = 0; i < n_row_blocks; i++)
33744 L.
submatrices[i * n_col_blocks + k]->mTmult_level_conserving(
33761 ->solve_cholesky_transpose_by_forward_substitution_matrix_valued(
33762 *(L.
submatrices[i * n_col_blocks + j]), Z, fixed_rank);
33771 *(L.
submatrices[i * n_col_blocks + i]), fixed_rank);
33775 Assert(
false, ExcInternalError());
33783template <
int spacedim,
typename Number>
33787 const unsigned int fixed_rank)
33789 this->_compute_cholesky_factorization(L, fixed_rank);
33798 this->set_state(HMatrixSupport::unusable);
33802template <
int spacedim,
typename Number>
33805 const unsigned int fixed_rank)
33807 Assert(this->state == HMatrixSupport::State::matrix,
33808 ExcInvalidHMatrixState(this->state));
33809 Assert(this->property == HMatrixSupport::Property::symmetric,
33810 ExcInvalidHMatrixProperty(this->property));
33811 Assert(this->block_type == HMatrixSupport::BlockType::diagonal_block,
33812 ExcInvalidHMatrixBlockType(this->block_type));
33825 Assert(fullmatrix !=
nullptr, ExcInternalError());
33827 Assert(fullmatrix->get_property() == LAPACKSupport::Property::symmetric,
33828 ExcInvalidLAPACKFullMatrixProperty(fullmatrix->get_property()));
33834 fullmatrix->compute_cholesky_factorization();
33838 const unsigned int n_row_blocks = get_n_row_blocks();
33839 const unsigned int n_col_blocks = get_n_col_blocks();
33845 AssertDimension(n_row_blocks, n_col_blocks);
33851 for (
size_type i = 0; i < n_row_blocks; i++)
33876 submatrices[i * n_col_blocks + k]->mTmult_level_conserving(
33877 *(submatrices[i * n_col_blocks + j]),
33879 *(submatrices[j * n_col_blocks + k]),
33892 submatrices[j * n_col_blocks + j]
33893 ->solve_cholesky_transpose_by_forward_substitution_matrix_valued(
33894 *(submatrices[i * n_col_blocks + j]), fixed_rank);
33902 submatrices[i * n_col_blocks + i]
33903 ->_compute_cholesky_factorization(fixed_rank);
33907 Assert(
false, ExcInternalError());
33915template <
int spacedim,
typename Number>
33918 const unsigned int fixed_rank)
33920 this->_compute_cholesky_factorization(fixed_rank);
33926 this->set_state(HMatrixSupport::cholesky);
33927 this->set_property(HMatrixSupport::Property::lower_triangular);
33931template <
int spacedim,
typename Number>
33934 const unsigned int fixed_rank,
33935 std::mutex &log_stream_lock)
33937 const unsigned int n_row_blocks = get_n_row_blocks();
33938 const unsigned int n_col_blocks = get_n_col_blocks();
33940 AssertDimension(n_row_blocks, n_col_blocks);
33945 for (
size_type i = 0; i < n_row_blocks; i++)
33950 submatrices[i * n_col_blocks + i];
33951 const bool is_diag_block_leaf = current_diag_block->
is_leaf();
33957 dag, log_stream_lock);
33966 current_diag_column_block !=
nullptr;
33967 current_diag_column_block =
33968 current_diag_column_block->next_same_level_same_column_hmat_node)
33970 if (is_diag_block_leaf || current_diag_column_block->is_leaf())
33978 dag, *current_diag_column_block, fixed_rank, log_stream_lock);
33985#if ENABLE_DEBUG == 1 && MESSAGE_LEVEL >= 2
33986 std::cout <<
"factorize-to-solve-transpose-upper at level "
33987 << current_diag_block->
bc_node->get_level() <<
": ["
33993 << (*current_diag_column_block->row_index_range)[0]
33995 << (*current_diag_column_block->row_index_range)[1]
33997 << (*current_diag_column_block->col_index_range)[0]
33999 << (*current_diag_column_block->col_index_range)[1]
34000 <<
")" << std::endl;
34002 tbb::flow::make_edge(
34004 *(current_diag_column_block
34005 ->solve_upper_or_lower_lu_or_cholesky_graph_node));
34025 current_trailing_block =
34027 *current_diag_column_block1 =
34029 *current_diag_column_block2 =
34031 current_trailing_block !=
nullptr;
34032 current_trailing_block =
34033 current_trailing_block->next_same_level_hmat_node)
34039 if ((*current_trailing_block->row_index_range)[0] >=
34041 (*current_trailing_block->col_index_range)[0] >=
34044 bool is_diag_column_block1_found =
false;
34045 bool is_diag_column_block2_found =
false;
34051 while (current_diag_column_block1 !=
nullptr &&
34052 current_diag_column_block1 != current_diag_block)
34054 if (*current_diag_column_block1->row_index_range ==
34055 *current_trailing_block->row_index_range)
34060 is_diag_column_block1_found =
true;
34064 else if ((*current_trailing_block->row_index_range)[0] >=
34065 (*current_diag_column_block1->row_index_range)[1])
34070 current_diag_column_block1 =
34071 current_diag_column_block1
34072 ->next_same_level_same_column_hmat_node;
34074 if (current_diag_column_block1 !=
nullptr &&
34075 (*current_diag_column_block1->row_index_range)[0] >=
34076 (*current_trailing_block->row_index_range)[1])
34088 else if ((*current_diag_column_block1->row_index_range)[0] >=
34089 (*current_trailing_block->row_index_range)[1])
34094 current_diag_column_block1 =
34095 current_diag_column_block1
34096 ->previous_same_level_same_column_hmat_node;
34098 if (current_diag_column_block1 !=
nullptr &&
34099 current_diag_column_block1 != current_diag_block &&
34100 (*current_trailing_block->row_index_range)[0] >=
34101 (*current_diag_column_block1->row_index_range)[1])
34115 if (is_diag_column_block1_found)
34122 while (current_diag_column_block2 !=
nullptr &&
34123 current_diag_column_block2 != current_diag_block)
34125 if (*current_diag_column_block2->row_index_range ==
34126 *current_trailing_block->col_index_range)
34131 is_diag_column_block2_found =
true;
34135 else if ((*current_trailing_block->col_index_range)[0] >=
34136 (*current_diag_column_block2
34137 ->row_index_range)[1])
34142 current_diag_column_block2 =
34143 current_diag_column_block2
34144 ->next_same_level_same_column_hmat_node;
34146 if (current_diag_column_block2 !=
nullptr &&
34147 (*current_diag_column_block2
34148 ->row_index_range)[0] >=
34149 (*current_trailing_block->col_index_range)[1])
34161 else if ((*current_diag_column_block2
34162 ->row_index_range)[0] >=
34163 (*current_trailing_block->col_index_range)[1])
34168 current_diag_column_block2 =
34169 current_diag_column_block2
34170 ->previous_same_level_same_column_hmat_node;
34172 if (current_diag_column_block2 !=
nullptr &&
34173 current_diag_column_block2 !=
34174 current_diag_block &&
34175 (*current_trailing_block->col_index_range)[0] >=
34176 (*current_diag_column_block2
34177 ->row_index_range)[1])
34191 if (!is_diag_column_block2_found)
34198 if (current_diag_column_block2 ==
nullptr ||
34199 current_diag_column_block2 == current_diag_block)
34201 current_diag_column_block2 =
34214 if (current_diag_column_block1 ==
nullptr ||
34215 current_diag_column_block1 == current_diag_block)
34217 current_diag_column_block1 =
34228 if (is_diag_column_block1_found && is_diag_column_block2_found)
34230 if (current_trailing_block->is_leaf() ||
34231 current_diag_column_block1->is_leaf() ||
34232 current_diag_column_block2->is_leaf())
34238 current_trailing_block->cholesky_update_task(
34240 *current_diag_block,
34241 *current_diag_column_block1,
34242 *current_diag_column_block2,
34251 current_diag_column_block1
34252 ->lu_or_cholesky_build_solve_upper_to_update_dependencies(
34253 *current_trailing_block);
34260 current_diag_column_block2
34261 ->lu_or_cholesky_build_solve_upper_to_update_dependencies(
34262 *current_trailing_block);
34271template <
int spacedim,
typename Number>
34274 tbb::flow::graph &dag,
34275 std::mutex &log_stream_lock)
34280 Assert(block_type == HMatrixSupport::BlockType::diagonal_block,
34281 ExcInvalidHMatrixBlockType(block_type));
34283 this->factorize_lu_or_cholesky_graph_node = std::make_shared<TaskNode>(
34284 dag, [
this, &log_stream_lock](
const tbb::flow::continue_msg &msg) {
34285#if ENABLE_DEBUG == 1 && MESSAGE_LEVEL >= 3
34287 std::lock_guard<std::mutex> lg(log_stream_lock);
34289 std::cout << std::this_thread::get_id() <<
"#cholesky_factorize: ["
34290 << (*this->row_index_range)[0] <<
","
34291 << (*this->row_index_range)[1] <<
"), ["
34292 << (*this->col_index_range)[0] <<
","
34293 << (*this->col_index_range)[1] <<
")" << std::endl;
34297 if (this->is_leaf())
34305 ExcInvalidHMatrixType(this->type));
34306 Assert(this->fullmatrix !=
nullptr, ExcInternalError());
34307 Assert(this->fullmatrix->get_property() ==
34308 LAPACKSupport::Property::symmetric,
34309 ExcInvalidLAPACKFullMatrixProperty(
34310 fullmatrix->get_property()));
34316 this->fullmatrix->compute_cholesky_factorization();
34324template <
int spacedim,
typename Number>
34327 tbb::flow::graph &dag,
34329 const unsigned int fixed_rank,
34330 std::mutex &log_stream_lock)
34335 Assert(block_type == HMatrixSupport::BlockType::diagonal_block,
34336 ExcInvalidHMatrixBlockType(block_type));
34337 Assert(Z.
block_type != HMatrixSupport::BlockType::diagonal_block,
34348 [
this, &Z, fixed_rank, &log_stream_lock](
34349 const tbb::flow::continue_msg &msg) {
34350#if ENABLE_DEBUG == 1 && MESSAGE_LEVEL >= 3
34352 std::lock_guard<std::mutex> lg(log_stream_lock);
34354 std::cout << std::this_thread::get_id() <<
"#cholesky_solve_upper: ["
34361 this->solve_cholesky_transpose_by_forward_substitution_matrix_valued(
34368template <
int spacedim,
typename Number>
34371 tbb::flow::graph &dag,
34375 const unsigned int fixed_rank,
34376 std::mutex &log_stream_lock)
34378 this->update_lu_or_cholesky_graph_nodes.push_back(
34381 std::make_shared<TaskNode>(
34384 &diag_column_block1,
34385 &diag_column_block2,
34387 &log_stream_lock](
const tbb::flow::continue_msg &msg) {
34388#if ENABLE_DEBUG == 1 && MESSAGE_LEVEL >= 3
34390 std::lock_guard<std::mutex> lg(log_stream_lock);
34392 std::cout << std::this_thread::get_id() <<
"#cholesky_update: ["
34401 <<
" --> [" << (*this->row_index_range)[0] <<
","
34402 << (*this->row_index_range)[1] <<
"), ["
34403 << (*this->col_index_range)[0] <<
","
34404 << (*this->col_index_range)[1] <<
")" << std::endl;
34408 diag_column_block1.mTmult_level_conserving_for_parallel_cholesky(
34411 diag_column_block2,
34413 this->property == HMatrixSupport::Property::symmetric);
34420template <
int spacedim,
typename Number>
34425 for (
auto &update_node : update_lu_or_cholesky_graph_nodes)
34427#if ENABLE_DEBUG == 1 && MESSAGE_LEVEL >= 2
34428 std::cout <<
"update-to-factorize at level ("
34429 << this->bc_node->get_level() <<
","
34430 << factorize_block.
bc_node->get_level() <<
"): ["
34431 << (*this->row_index_range)[0] <<
","
34432 << (*this->row_index_range)[1] <<
"), ["
34433 << (*this->col_index_range)[0] <<
","
34434 << (*this->col_index_range)[1] <<
") --> ["
34441 tbb::flow::make_edge(
34442 *update_node.update,
34449 for (
auto submatrix : submatrices)
34451 if (submatrix->block_type !=
34452 HMatrixSupport::BlockType::upper_triangular_block)
34454 submatrix->cholesky_build_update_to_factorize_dependencies(
34461template <
int spacedim,
typename Number>
34466 Assert(block_type == HMatrixSupport::BlockType::lower_triangular_block,
34467 ExcInternalError());
34469 for (
auto &update_node : update_lu_or_cholesky_graph_nodes)
34471#if ENABLE_DEBUG == 1 && MESSAGE_LEVEL >= 2
34473 HMatrixSupport::BlockType::lower_triangular_block,
34474 ExcInvalidHMatrixBlockType(solve_upper_block.
block_type));
34476 std::cout <<
"update-to-solve-upper at level ("
34477 << this->bc_node->get_level() <<
","
34478 << solve_upper_block.
bc_node->get_level() <<
"): ["
34479 << (*update_node.diagonal_hmat_node->row_index_range)[0] <<
","
34480 << (*update_node.diagonal_hmat_node->row_index_range)[1]
34482 << (*update_node.diagonal_hmat_node->col_index_range)[0] <<
","
34483 << (*update_node.diagonal_hmat_node->col_index_range)[1]
34490 tbb::flow::make_edge(
34491 *update_node.update,
34498 for (
auto submatrix : submatrices)
34500 if (submatrix->block_type !=
34501 HMatrixSupport::BlockType::upper_triangular_block)
34503 submatrix->cholesky_build_update_to_solve_upper_dependencies(
34504 solve_upper_block);
34510template <
int spacedim,
typename Number>
34513 Number>::cholesky_assign_update_to_solve_and_factorize_dependencies()
34515 if (solve_upper_or_lower_lu_or_cholesky_graph_node)
34521 cholesky_build_update_to_solve_upper_dependencies(*
this);
34531 if (block_type == HMatrixSupport::BlockType::diagonal_block)
34538 if (factorize_lu_or_cholesky_graph_node)
34540 cholesky_build_update_to_factorize_dependencies(*
this);
34548 if (parent !=
nullptr &&
34549 parent->factorize_lu_or_cholesky_graph_node &&
34554 submatrix_index == (parent->get_n_row_blocks() - 1) *
34555 (parent->get_n_col_blocks() + 1))
34557#if ENABLE_DEBUG == 1 && MESSAGE_LEVEL >= 2
34558 std::cout <<
"factorize-to-factorize at level ("
34559 << this->bc_node->get_level() <<
","
34560 << parent->bc_node->get_level() <<
"): ["
34561 << (*this->row_index_range)[0] <<
","
34562 << (*this->row_index_range)[1] <<
"), ["
34563 << (*this->col_index_range)[0] <<
","
34564 << (*this->col_index_range)[1] <<
") --> ["
34565 << (*parent->row_index_range)[0] <<
","
34566 << (*parent->row_index_range)[1] <<
"), ["
34567 << (*parent->col_index_range)[0] <<
","
34568 << (*parent->col_index_range)[1] <<
")"
34572 tbb::flow::make_edge(
34573 *factorize_lu_or_cholesky_graph_node,
34574 *parent->factorize_lu_or_cholesky_graph_node);
34584 for (
auto submatrix : submatrices)
34586 if (submatrix->block_type !=
34587 HMatrixSupport::BlockType::upper_triangular_block)
34592 if (update_lu_or_cholesky_graph_nodes.size() > 0)
34594 submatrix->update_lu_or_cholesky_graph_nodes.insert(
34595 submatrix->update_lu_or_cholesky_graph_nodes.end(),
34596 update_lu_or_cholesky_graph_nodes.begin(),
34597 update_lu_or_cholesky_graph_nodes.end());
34601 ->cholesky_assign_update_to_solve_and_factorize_dependencies();
34608template <
int spacedim,
typename Number>
34614 Assert(fullmatrix !=
nullptr, ExcInternalError());
34616 switch (top_hmat_property)
34618 case HMatrixSupport::Property::general: {
34621 case HMatrixSupport::Property::symmetric:
34622 case HMatrixSupport::Property::hermite_symmetric: {
34623 switch (block_type)
34625 case HMatrixSupport::BlockType::diagonal_block: {
34628 case HMatrixSupport::BlockType::lower_triangular_block: {
34632 Assert(
false, ExcInvalidHMatrixBlockType(block_type));
34638 case HMatrixSupport::Property::lower_triangular: {
34639 switch (block_type)
34641 case HMatrixSupport::BlockType::diagonal_block: {
34642 return m * n / 2.0;
34644 case HMatrixSupport::BlockType::lower_triangular_block: {
34648 Assert(
false, ExcInvalidHMatrixBlockType(block_type));
34654 case HMatrixSupport::Property::upper_triangular: {
34655 switch (block_type)
34657 case HMatrixSupport::BlockType::diagonal_block: {
34658 return m * n / 2.0;
34660 case HMatrixSupport::BlockType::upper_triangular_block: {
34664 Assert(
false, ExcInvalidHMatrixBlockType(block_type));
34671 Assert(
false, ExcInvalidHMatrixProperty(top_hmat_property));
34679template <
int spacedim,
typename Number>
34685 Assert(rkmatrix !=
nullptr, ExcInternalError());
34687 switch (top_hmat_property)
34689 case HMatrixSupport::Property::general: {
34690 return rkmatrix->get_formal_rank() * (m + n);
34692 case HMatrixSupport::Property::symmetric:
34693 case HMatrixSupport::Property::hermite_symmetric: {
34694 if (block_type == HMatrixSupport::BlockType::lower_triangular_block)
34696 return 2 * rkmatrix->get_formal_rank() * (m + n);
34700 Assert(
false, ExcInvalidHMatrixBlockType(block_type));
34705 case HMatrixSupport::Property::lower_triangular: {
34706 if (block_type == HMatrixSupport::BlockType::lower_triangular_block)
34708 return rkmatrix->get_formal_rank() * (m + n);
34712 Assert(
false, ExcInvalidHMatrixBlockType(block_type));
34717 case HMatrixSupport::Property::upper_triangular: {
34718 if (block_type == HMatrixSupport::BlockType::upper_triangular_block)
34720 return rkmatrix->get_formal_rank() * (m + n);
34724 Assert(
false, ExcInvalidHMatrixBlockType(block_type));
34730 Assert(
false, ExcInvalidHMatrixProperty(top_hmat_property));
34738template <
int spacedim,
typename Number>
34741 std::vector<double> &task_costs)
const
34743 AssertDimension(leaf_set.size(), task_costs.size());
34745 unsigned int i = 0;
34746 for (
const auto hmat : leaf_set)
34748 switch (hmat->type)
34752 hmat->compute_near_field_hmat_vmult_or_Tvmult_task_cost(
34759 hmat->compute_far_field_hmat_vmult_or_Tvmult_task_cost(
34765 Assert(
false, ExcInvalidHMatrixType(hmat->type));
34777template <
int spacedim,
typename Number>
34783 Assert(fullmatrix !=
nullptr, ExcInternalError());
34785 switch (top_hmat_property)
34787 case HMatrixSupport::Property::general: {
34790 case HMatrixSupport::Property::symmetric:
34791 case HMatrixSupport::Property::hermite_symmetric:
34792 case HMatrixSupport::Property::lower_triangular: {
34793 switch (block_type)
34795 case HMatrixSupport::BlockType::diagonal_block: {
34796 return m * n / 2.0 + m / 2.0;
34798 case HMatrixSupport::BlockType::lower_triangular_block: {
34802 Assert(
false, ExcInvalidHMatrixBlockType(block_type));
34808 case HMatrixSupport::Property::upper_triangular: {
34809 switch (block_type)
34811 case HMatrixSupport::BlockType::diagonal_block: {
34812 return m * n / 2.0 + m / 2.0;
34814 case HMatrixSupport::BlockType::upper_triangular_block: {
34818 Assert(
false, ExcInvalidHMatrixBlockType(block_type));
34825 Assert(
false, ExcInvalidHMatrixProperty(top_hmat_property));
34833template <
int spacedim,
typename Number>
34836 std::vector<double> &task_costs)
const
34838 AssertDimension(near_field_leaf_set.size(), task_costs.size());
34840 unsigned int i = 0;
34841 for (
const auto hmat : near_field_leaf_set)
34844 ExcInvalidHMatrixType(hmat->type));
34846 hmat->compute_near_field_hmat_assembly_task_cost(property);
34853template <
int spacedim,
typename Number>
34859 Assert(rkmatrix !=
nullptr, ExcInternalError());
34865 switch (top_hmat_property)
34867 case HMatrixSupport::Property::general: {
34868 if (block_type == HMatrixSupport::BlockType::lower_triangular_block ||
34869 block_type == HMatrixSupport::BlockType::upper_triangular_block)
34871 return rkmatrix->get_formal_rank() * (m + n);
34875 Assert(
false, ExcInvalidHMatrixBlockType(block_type));
34880 case HMatrixSupport::Property::symmetric:
34881 case HMatrixSupport::Property::hermite_symmetric:
34882 case HMatrixSupport::Property::lower_triangular: {
34883 if (block_type == HMatrixSupport::BlockType::lower_triangular_block)
34885 return rkmatrix->get_formal_rank() * (m + n);
34889 Assert(
false, ExcInvalidHMatrixBlockType(block_type));
34894 case HMatrixSupport::Property::upper_triangular: {
34895 if (block_type == HMatrixSupport::BlockType::upper_triangular_block)
34897 return rkmatrix->get_formal_rank() * (m + n);
34901 Assert(
false, ExcInvalidHMatrixBlockType(block_type));
34907 Assert(
false, ExcInvalidHMatrixProperty(top_hmat_property));
34915template <
int spacedim,
typename Number>
34918 std::vector<double> &task_costs)
const
34920 AssertDimension(far_field_leaf_set.size(), task_costs.size());
34922 unsigned int i = 0;
34923 for (
const auto hmat : far_field_leaf_set)
34926 ExcInvalidHMatrixType(hmat->type));
34927 task_costs[i] = hmat->compute_far_field_hmat_assembly_task_cost(property);
34934template <
int spacedim,
typename Number>
34937 const std::pair<int64_t, int64_t> &interval,
34938 const unsigned int thread_no)
34940 Assert(interval.second >= interval.first, ExcInternalError());
34942 const unsigned int hmat_num = interval.second - interval.first + 1;
34943 std::vector<types::global_dof_index> index_range_lower_bound(hmat_num);
34944 std::vector<types::global_dof_index> index_range_upper_bound(hmat_num);
34946 for (
unsigned int i = interval.first; i <= interval.second; i++)
34948 index_range_lower_bound[i - interval.first] =
34949 (*leaf_set[i]->row_index_range)[0];
34950 index_range_upper_bound[i - interval.first] =
34951 (*leaf_set[i]->row_index_range)[1];
34958 typename std::vector<types::global_dof_index>::iterator min_it =
34959 std::min_element(index_range_lower_bound.begin(),
34960 index_range_lower_bound.end());
34961 typename std::vector<types::global_dof_index>::iterator max_it =
34962 std::max_element(index_range_upper_bound.begin(),
34963 index_range_upper_bound.end());
34965 (*data_for_vmult_or_tvmult_threads)[thread_no]
34966 .local_vmult_result_index_range[0] = *min_it;
34967 (*data_for_vmult_or_tvmult_threads)[thread_no]
34968 .local_vmult_result_index_range[1] = *max_it;
34970 Assert((*data_for_vmult_or_tvmult_threads)[thread_no]
34971 .local_vmult_result_index_range[1] >
34972 (*data_for_vmult_or_tvmult_threads)[thread_no]
34973 .local_vmult_result_index_range[0],
34974 ExcInternalError());
34978template <
int spacedim,
typename Number>
34981 const std::pair<int64_t, int64_t> &interval,
34982 const unsigned int thread_no)
34984 Assert(interval.second >= interval.first, ExcInternalError());
34986 const unsigned int hmat_num = interval.second - interval.first + 1;
34987 std::vector<types::global_dof_index> index_range_lower_bound(hmat_num);
34988 std::vector<types::global_dof_index> index_range_upper_bound(hmat_num);
34990 for (
unsigned int i = interval.first; i <= interval.second; i++)
34992 index_range_lower_bound[i - interval.first] =
34993 (*leaf_set[i]->col_index_range)[0];
34994 index_range_upper_bound[i - interval.first] =
34995 (*leaf_set[i]->col_index_range)[1];
35002 typename std::vector<types::global_dof_index>::iterator min_it =
35003 std::min_element(index_range_lower_bound.begin(),
35004 index_range_lower_bound.end());
35005 typename std::vector<types::global_dof_index>::iterator max_it =
35006 std::max_element(index_range_upper_bound.begin(),
35007 index_range_upper_bound.end());
35009 (*data_for_vmult_or_tvmult_threads)[thread_no]
35010 .local_tvmult_result_index_range[0] = *min_it;
35011 (*data_for_vmult_or_tvmult_threads)[thread_no]
35012 .local_tvmult_result_index_range[1] = *max_it;
35014 Assert((*data_for_vmult_or_tvmult_threads)[thread_no]
35015 .local_tvmult_result_index_range[1] >
35016 (*data_for_vmult_or_tvmult_threads)[thread_no]
35017 .local_tvmult_result_index_range[0],
35018 ExcInternalError());
35022template <
int spacedim,
typename Number>
35026 const unsigned int thread_no)
35028 const unsigned int thread_num = data_for_vmult_or_tvmult_threads->size();
35030 (*data_for_vmult_or_tvmult_threads)[thread_no]
35031 .vmult_result_index_ranges_contributed_from_other_threads.clear();
35032 (*data_for_vmult_or_tvmult_threads)[thread_no]
35033 .vmult_result_index_ranges_contributed_from_other_threads.resize(
35036 std::array<types::global_dof_index, 2> range_intersection;
35038 for (
unsigned int i = 0; i < thread_num; i++)
35041 (*data_for_vmult_or_tvmult_threads)[thread_no].vmult_result_index_range,
35042 (*data_for_vmult_or_tvmult_threads)[i].local_vmult_result_index_range,
35043 range_intersection);
35045 (*data_for_vmult_or_tvmult_threads)[thread_no]
35046 .vmult_result_index_ranges_contributed_from_other_threads[i] =
35047 range_intersection;
35052template <
int spacedim,
typename Number>
35056 const unsigned int thread_no)
35058 const unsigned int thread_num = data_for_vmult_or_tvmult_threads->size();
35060 (*data_for_vmult_or_tvmult_threads)[thread_no]
35061 .tvmult_result_index_ranges_contributed_from_other_threads.clear();
35062 (*data_for_vmult_or_tvmult_threads)[thread_no]
35063 .tvmult_result_index_ranges_contributed_from_other_threads.resize(
35066 std::array<types::global_dof_index, 2> range_intersection;
35068 for (
unsigned int i = 0; i < thread_num; i++)
35071 (*data_for_vmult_or_tvmult_threads)[thread_no]
35072 .tvmult_result_index_range,
35073 (*data_for_vmult_or_tvmult_threads)[i].local_tvmult_result_index_range,
35074 range_intersection);
35076 (*data_for_vmult_or_tvmult_threads)[thread_no]
35077 .tvmult_result_index_ranges_contributed_from_other_threads[i] =
35078 range_intersection;
35083template <
int spacedim,
typename Number>
35086 const bool is_vmult,
35087 const bool is_tvmult)
const
35093 unsigned int thread_num =
35094 std::min(
static_cast<size_t>(MultithreadInfo::n_threads()),
35104 if (this->m < thread_num)
35106 thread_num = this->m;
35117 if (this->n < thread_num)
35119 thread_num = this->n;
35127template <
int spacedim,
typename Number>
35130 const bool is_tvmult)
35135 Assert(parent ==
nullptr, ExcInternalError());
35137 const unsigned int thread_num =
35138 compute_vmult_or_tvmult_thread_num(is_vmult, is_tvmult);
35144 if (thread_num > 1)
35146 data_for_vmult_or_tvmult_threads =
35147 std::make_unique<std::vector<VmultOrTvmultThreadData>>(thread_num);
35152 std::vector<double> task_costs(leaf_set.size());
35153 this->compute_leaf_set_vmult_or_Tvmult_task_costs(task_costs);
35158 auto cost_func = [&task_costs](
int i,
int j) ->
double {
35161 for (
int k = i; k <= j; k++)
35163 sum += task_costs[k];
35174 std::vector<std::pair<int64_t, int64_t>> leaf_set_intervals;
35175 sp.get_partitions(leaf_set_intervals);
35177 auto prepare_thread_self_data =
35181 is_tvmult](
const std::pair<int64_t, int64_t> &interval,
35182 const unsigned int thread_no) ->
void {
35183 (*this->data_for_vmult_or_tvmult_threads)[thread_no].leaf_set_interval =
35191 this->get_row_index_range_for_leaf_set_interval(interval,
35197 (*this->data_for_vmult_or_tvmult_threads)[thread_no]
35198 .local_vmult_result.reinit(
35199 (*this->data_for_vmult_or_tvmult_threads)[thread_no]
35200 .local_vmult_result_index_range[1] -
35201 (*this->data_for_vmult_or_tvmult_threads)[thread_no]
35202 .local_vmult_result_index_range[0]);
35208 types::global_dof_index vmult_result_vector_size =
35209 this->m / thread_num;
35210 Assert(vmult_result_vector_size > 0, ExcInternalError());
35212 (*this->data_for_vmult_or_tvmult_threads)[thread_no]
35213 .vmult_result_index_range[0] =
35214 thread_no * vmult_result_vector_size;
35215 (*this->data_for_vmult_or_tvmult_threads)[thread_no]
35216 .vmult_result_index_range[1] =
35217 thread_no == thread_num - 1 ?
35219 (thread_no + 1) * vmult_result_vector_size;
35227 this->get_column_index_range_for_leaf_set_interval(interval,
35233 (*this->data_for_vmult_or_tvmult_threads)[thread_no]
35234 .local_tvmult_result.reinit(
35235 (*this->data_for_vmult_or_tvmult_threads)[thread_no]
35236 .local_tvmult_result_index_range[1] -
35237 (*this->data_for_vmult_or_tvmult_threads)[thread_no]
35238 .local_tvmult_result_index_range[0]);
35244 types::global_dof_index tvmult_result_vector_size =
35245 this->n / thread_num;
35246 Assert(tvmult_result_vector_size > 0, ExcInternalError());
35248 (*this->data_for_vmult_or_tvmult_threads)[thread_no]
35249 .tvmult_result_index_range[0] =
35250 thread_no * tvmult_result_vector_size;
35251 (*this->data_for_vmult_or_tvmult_threads)[thread_no]
35252 .tvmult_result_index_range[1] =
35253 thread_no == thread_num - 1 ?
35255 (thread_no + 1) * tvmult_result_vector_size;
35259 Threads::TaskGroup<void> thread_self_preparation_tasks;
35260 for (
unsigned int i = 0; i < thread_num; i++)
35262 thread_self_preparation_tasks += Threads::new_task(
35263 std::bind(prepare_thread_self_data, leaf_set_intervals[i], i));
35266 thread_self_preparation_tasks.join_all();
35268 auto prepare_thread_mutual_data =
35269 [
this, is_vmult, is_tvmult](
const unsigned int thread_no) ->
void {
35276 this->compute_vmult_contributing_index_ranges_from_all_threads(
35286 this->compute_tvmult_contributing_index_ranges_from_all_threads(
35291 Threads::TaskGroup<void> thread_mutual_preparation_tasks;
35292 for (
unsigned int i = 0; i < thread_num; i++)
35294 thread_mutual_preparation_tasks +=
35295 Threads::new_task(std::bind(prepare_thread_mutual_data, i));
35298 thread_mutual_preparation_tasks.join_all();
35303 this->set_vmult_strategy(
35309template <
int spacedim,
typename Number>
35312 const unsigned int fixed_rank)
35315 const int blas_num_threads = openblas_get_num_threads();
35316 openblas_set_num_threads(1);
35318#if ENABLE_DEBUG == 1 && ENABLE_TIMER == 1
35324 this->link_hmat_nodes_on_cross_from_diagonal_blocks(this->property);
35325#if ENABLE_DEBUG == 1 && ENABLE_TIMER == 1
35333 std::mutex log_stream_lock;
35338 tbb::flow::graph dag;
35340#if ENABLE_DEBUG == 1 && ENABLE_TIMER == 1
35343 compute_cholesky_dag(dag, fixed_rank, log_stream_lock);
35344#if ENABLE_DEBUG == 1 && ENABLE_TIMER == 1
35349#if ENABLE_DEBUG == 1 && ENABLE_TIMER == 1
35352 cholesky_assign_update_to_solve_and_factorize_dependencies();
35353#if ENABLE_DEBUG == 1 && ENABLE_TIMER == 1
35363 Assert(top_left_node !=
nullptr, ExcInternalError());
35365 ExcInternalError());
35367#if ENABLE_DEBUG == 1 && ENABLE_TIMER == 1
35371 tbb::flow::continue_msg());
35373 dag.wait_for_all();
35374#if ENABLE_DEBUG == 1 && ENABLE_TIMER == 1
35378 clear_lu_or_cholesky_task_nodes();
35384 this->set_state(HMatrixSupport::cholesky);
35385 this->set_property(HMatrixSupport::Property::lower_triangular);
35388 openblas_set_num_threads(blas_num_threads);
35392template <
int spacedim,
typename Number>
35395 const Vector<Number> &b)
const
35397 Assert(state == HMatrixSupport::lu, ExcInvalidHMatrixState(state));
35401 solve_by_forward_substitution(x,
true);
35403 solve_by_backward_substitution(x,
false);
35407template <
int spacedim,
typename Number>
35410 const Vector<Number> &b)
const
35412 Assert(state == HMatrixSupport::cholesky,
35413 ExcMessage(std::string(
"Invalid H-matrix state: ") +
35414 std::string(HMatrixSupport::state_name(state))));
35417 solve_cholesky_by_forward_substitution(x);
35418 solve_cholesky_by_backward_substitution(x);
35422template <
int spacedim,
typename Number>
35428 AssertDimension(m, n);
35442 if (*(bc_node->get_data_reference().get_tau_node()) ==
35443 *(bc_node->get_data_reference().get_sigma_node()) &&
35444 bc_node->is_leaf())
35448 this->fullmatrix->invert_by_gauss_elim(*(M_inv.
fullmatrix));
35452 AssertDimension(get_n_row_blocks(), get_n_col_blocks());
35458 const size_type k = get_n_col_blocks();
35490 const size_type diag_block_index_in_submatrices = l + l * k;
35491 submatrices[diag_block_index_in_submatrices]->_invert_by_gauss_elim(
35492 *(M_inv.
submatrices[diag_block_index_in_submatrices]),
35508 M_inv.
submatrices[diag_block_index_in_submatrices]
35509 ->mmult_level_conserving(*C,
35510 *(submatrices[j + l * k]),
35516 *(submatrices[j + l * k]) = std::move(*C);
35529 M_inv.
submatrices[j + l * k]->bc_node, fixed_rank_k);
35530 M_inv.
submatrices[diag_block_index_in_submatrices]
35531 ->mmult_level_conserving(*C,
35553 M_inv.
submatrices[j + i * k]->bc_node, fixed_rank_k);
35554 submatrices[l + i * k]->mmult_level_conserving(
35555 *C, *(M_inv.
submatrices[j + l * k]), fixed_rank_k);
35556 M_inv.
submatrices[j + i * k]->add(-1.0, *C, fixed_rank_k);
35564 submatrices[j + i * k]->bc_node, fixed_rank_k);
35565 submatrices[l + i * k]->mmult_level_conserving(
35566 *C, *(submatrices[j + l * k]), fixed_rank_k);
35567 submatrices[j + i * k]->add(-1.0, *C, fixed_rank_k);
35588 M_inv.
submatrices[j + i * k]->bc_node, fixed_rank_k);
35589 submatrices[l + i * k]->mmult_level_conserving(
35590 *C, *(M_inv.
submatrices[j + l * k]), fixed_rank_k);
35591 M_inv.
submatrices[j + i * k]->add(-1.0, *C, fixed_rank_k);
35610template <
int spacedim,
typename Number>
35614 const unsigned int fixed_rank_k)
35616 coarsen_to_partition(subtree.
get_leaf_set(), fixed_rank_k);
35618 link_hmat_nodes_on_same_levels();
35622template <
int spacedim,
typename Number>
35628 const unsigned int fixed_rank_k)
35654 for (
HMatrix *submatrix : submatrices)
35656 submatrix->coarsen_to_partition(partition, fixed_rank_k);
35662template <
int spacedim,
typename Number>
35668 std::queue<HMatrix<spacedim, Number> *> work_queue;
35670 if (submatrices.size() > 0)
35672 work_queue.push(
this);
35674 while (!work_queue.empty())
35683 if (work_queue.size() > 0)
35686 if (current_hmat_node->
bc_node->get_level() ==
35687 next_hmat_node->
bc_node->get_level())
35706 switch (top_hmat_property)
35708 case HMatrixSupport::Property::general:
35709 work_queue.push(hmat);
35712 case HMatrixSupport::Property::symmetric:
35713 case HMatrixSupport::Property::hermite_symmetric:
35714 case HMatrixSupport::Property::lower_triangular:
35715 if (hmat->block_type ==
35716 HMatrixSupport::BlockType::diagonal_block ||
35717 hmat->block_type ==
35718 HMatrixSupport::BlockType::lower_triangular_block)
35720 work_queue.push(hmat);
35724 case HMatrixSupport::Property::upper_triangular:
35725 if (hmat->block_type ==
35726 HMatrixSupport::BlockType::diagonal_block ||
35727 hmat->block_type ==
35728 HMatrixSupport::BlockType::upper_triangular_block)
35730 work_queue.push(hmat);
35735 Assert(
false, ExcInvalidHMatrixProperty(top_hmat_property));
35745template <
int spacedim,
typename Number>
35750 Assert(block_type == HMatrixSupport::BlockType::diagonal_block,
35751 ExcInvalidHMatrixBlockType(block_type));
35760 this->next_same_level_same_row_hmat_node =
nullptr;
35761 this->next_same_level_same_column_hmat_node =
nullptr;
35762 this->previous_same_level_same_row_hmat_node =
nullptr;
35763 this->previous_same_level_same_column_hmat_node =
nullptr;
35766 this->next_same_level_hmat_node;
35768 while (current_hmat_node_on_same_level !=
nullptr)
35775 if (top_hmat_property == HMatrixSupport::Property::general ||
35776 top_hmat_property == HMatrixSupport::Property::upper_triangular)
35783 *this->row_index_range)
35791 (*this->col_index_range)[1],
35792 ExcInternalError());
35794 current_hmat_node_on_same_row
35796 current_hmat_node_on_same_level;
35797 current_hmat_node_on_same_level
35799 current_hmat_node_on_same_row;
35804 current_hmat_node_on_same_row =
35805 current_hmat_node_on_same_row
35815 if (top_hmat_property == HMatrixSupport::Property::general ||
35816 top_hmat_property == HMatrixSupport::Property::symmetric ||
35817 top_hmat_property == HMatrixSupport::Property::hermite_symmetric ||
35818 top_hmat_property == HMatrixSupport::Property::lower_triangular)
35825 *this->col_index_range)
35833 (*this->row_index_range)[1],
35834 ExcInternalError());
35836 current_hmat_node_on_same_column
35838 current_hmat_node_on_same_level;
35839 current_hmat_node_on_same_level
35841 current_hmat_node_on_same_column;
35846 current_hmat_node_on_same_column =
35847 current_hmat_node_on_same_column
35855 current_hmat_node_on_same_level =
35862 if (submatrices.size() > 0)
35864 const unsigned int n_row_blocks = get_n_row_blocks();
35865 const unsigned int n_col_blocks = get_n_col_blocks();
35867 for (
size_type i = 0; i < n_row_blocks; i++)
35869 submatrices[i * n_col_blocks + i]
35870 ->link_hmat_nodes_on_cross_from_diagonal_blocks(top_hmat_property);
35876template <
int spacedim,
typename Number>
35880 Assert(block_type == HMatrixSupport::BlockType::diagonal_block,
35881 ExcInvalidHMatrixBlockType(block_type));
35887 return current_node;
35894template <
int spacedim,
typename Number>
35898 Assert(block_type == HMatrixSupport::BlockType::diagonal_block,
35899 ExcInvalidHMatrixBlockType(block_type));
35905 return current_node;
35912template <
int spacedim,
typename Number>
35917 near_field_leaf_set.clear();
35918 far_field_leaf_set.clear();
35922 case SpaceFillingCurveType::Z: {
35923 _build_leaf_set_z_traversal(leaf_set,
35924 near_field_leaf_set,
35925 far_field_leaf_set,
35930 case SpaceFillingCurveType::Hilbert: {
35934 _build_leaf_set_hilbert_traversal(leaf_set,
35935 near_field_leaf_set,
35936 far_field_leaf_set,
35937 HilbertBlockType::A,
35946template <
int spacedim,
typename Number>
35947inline std::vector<HMatrix<spacedim, Number> *> &
35954template <
int spacedim,
typename Number>
35955inline const std::vector<HMatrix<spacedim, Number> *> &
35962template <
int spacedim,
typename Number>
35963inline std::vector<HMatrix<spacedim, Number> *> &
35966 return near_field_leaf_set;
35970template <
int spacedim,
typename Number>
35971inline const std::vector<HMatrix<spacedim, Number> *> &
35974 return near_field_leaf_set;
35978template <
int spacedim,
typename Number>
35979inline std::vector<HMatrix<spacedim, Number> *> &
35982 return far_field_leaf_set;
35986template <
int spacedim,
typename Number>
35987inline const std::vector<HMatrix<spacedim, Number> *> &
35990 return far_field_leaf_set;
35993template <
int spacedim,
typename Number>
35994inline std::array<types::global_dof_index, 2> *
35997 return row_index_range;
36001template <
int spacedim,
typename Number>
36002inline const std::array<types::global_dof_index, 2> *
36005 return row_index_range;
36009template <
int spacedim,
typename Number>
36010inline std::array<types::global_dof_index, 2> *
36013 return col_index_range;
36017template <
int spacedim,
typename Number>
36018inline const std::array<types::global_dof_index, 2> *
36021 return col_index_range;
36025template <
int spacedim,
typename Number>
36026typename std::vector<HMatrix<spacedim, Number> *>::iterator
36030 typename std::vector<HMatrix<spacedim, Number> *>::iterator iter;
36031 for (iter = leaf_set.begin(); iter != leaf_set.end(); iter++)
36045 if ((*iter)->bc_node !=
nullptr)
36047 if ((*iter)->bc_node->get_data_reference() == block_cluster)
36058template <
int spacedim,
typename Number>
36059typename std::vector<HMatrix<spacedim, Number> *>::const_iterator
36065 iter != leaf_set.cend();
36080 if ((*iter)->bc_node !=
nullptr)
36082 if ((*iter)->bc_node->get_data_reference() == block_cluster)
36091template <
int spacedim,
typename Number>
36104 for (
HMatrix *hmat_leaf_node : leaf_set)
36115 if (hmat_leaf_node->submatrices.size() > 0)
36124 switch (hmat_leaf_node->type)
36127 delete hmat_leaf_node->fullmatrix;
36128 hmat_leaf_node->fullmatrix =
nullptr;
36133 delete hmat_leaf_node->rkmatrix;
36134 hmat_leaf_node->rkmatrix =
nullptr;
36139 Assert(
false, ExcInvalidHMatrixType(hmat_leaf_node->type));
36155 link_hmat_nodes_on_same_levels();
36164template <
int spacedim,
typename Number>
36169 const unsigned int fixed_rank_k2)
36175 std::vector<typename BlockClusterTree<spacedim, real_type>::node_pointer_type>
36188 this->refine_to_supertree();
36219 if (is_bct2_extended)
36258 (*this) = std::move(hmat_new);
36262template <
int spacedim,
typename Number>
36272 typename std::vector<std::pair<HMatrix<spacedim, Number> *,
36274 matched_hmat_pair_iter =
36275 std::find(Sigma_P.begin(), Sigma_P.end(), current_hmat_pair);
36277 if (matched_hmat_pair_iter != Sigma_P.end())
36279 Sigma_P.erase(matched_hmat_pair_iter);
36284template <
int spacedim,
typename Number>
36290 typename std::vector<std::pair<HMatrix<spacedim, Number> *,
36292 matched_hmat_pair_iter =
36293 std::find(Sigma_P.begin(), Sigma_P.end(), hmat_pair);
36295 if (matched_hmat_pair_iter != Sigma_P.end())
36297 Sigma_P.erase(matched_hmat_pair_iter);
36302template <
int spacedim,
typename Number>
36310 &hmat_pair : Sigma_P)
36312 if ((hmat_pair.first->bc_node->get_split_mode() == HorizontalSplitMode &&
36313 hmat_pair.second->bc_node->get_split_mode() == UnsplitMode) ||
36314 (hmat_pair.first->bc_node->get_split_mode() == CrossSplitMode &&
36315 hmat_pair.second->bc_node->get_split_mode() == HorizontalSplitMode))
36317 current_split_mode = HorizontalSplitMode;
36319 else if ((hmat_pair.first->bc_node->get_split_mode() == UnsplitMode &&
36320 hmat_pair.second->bc_node->get_split_mode() ==
36321 VerticalSplitMode) ||
36322 (hmat_pair.first->bc_node->get_split_mode() ==
36323 VerticalSplitMode &&
36324 hmat_pair.second->bc_node->get_split_mode() == CrossSplitMode))
36326 current_split_mode = VerticalSplitMode;
36328 else if ((hmat_pair.first->bc_node->get_split_mode() == CrossSplitMode &&
36329 hmat_pair.second->bc_node->get_split_mode() ==
36331 (hmat_pair.first->bc_node->get_split_mode() ==
36332 HorizontalSplitMode &&
36333 hmat_pair.second->bc_node->get_split_mode() ==
36334 VerticalSplitMode))
36336 current_split_mode = CrossSplitMode;
36342 "Inconsistent case met during H-matrix MM multiplication"));
36347 initial_split_mode = current_split_mode;
36349 else if (current_split_mode != initial_split_mode)
36353 "Inconsistent case met during H-matrix MM multiplication"));
36359 return initial_split_mode;
36362template <
int spacedim,
typename Number>
36366 std::size_t memory_for_hmat_node = 0;
36374 memory_for_hmat_node += this->fullmatrix->memory_consumption();
36378 memory_for_hmat_node += this->rkmatrix->memory_consumption();
36384 memory_for_hmat_node +=
36386 (MemoryConsumption::memory_consumption(leaf_set) -
sizeof(leaf_set)) +
36387 (MemoryConsumption::memory_consumption(submatrices) -
sizeof(submatrices)) +
36388 (MemoryConsumption::memory_consumption(near_field_leaf_set) -
36389 sizeof(near_field_leaf_set)) +
36390 (MemoryConsumption::memory_consumption(far_field_leaf_set) -
36391 sizeof(far_field_leaf_set)) +
36392 (Tind.memory_consumption() -
sizeof(Tind)) +
36393 (MemoryConsumption::memory_consumption(Sigma_P) -
sizeof(Sigma_P)) +
36394 (MemoryConsumption::memory_consumption(Sigma_R) -
sizeof(Sigma_R)) +
36395 (MemoryConsumption::memory_consumption(Sigma_F) -
sizeof(Sigma_F)) +
36396 sizeof(data_for_vmult_or_tvmult_threads);
36398 if (data_for_vmult_or_tvmult_threads !=
nullptr)
36399 memory_for_hmat_node +=
36400 MemoryConsumption::memory_consumption(*data_for_vmult_or_tvmult_threads);
36402 return memory_for_hmat_node;
36406template <
int spacedim,
typename Number>
36410 std::size_t total_memory = 0;
36412 total_memory += memory_consumption_of_current_hmat_node();
36414 for (
auto submatrix : submatrices)
36416 total_memory += submatrix->memory_consumption();
36419 return total_memory;
36423template <
int spacedim,
typename Number>
36427 std::size_t total_memory = 0;
36429 for (
auto hmat : leaf_set)
36431 total_memory += hmat->memory_consumption();
36434 return total_memory;
36438template <
int spacedim,
typename Number>
36442 std::size_t total_memory = 0;
36444 for (
auto hmat : near_field_leaf_set)
36446 total_memory += hmat->memory_consumption();
36449 return total_memory;
36453template <
int spacedim,
typename Number>
36457 std::size_t total_memory = 0;
36459 for (
auto hmat : far_field_leaf_set)
36461 total_memory += hmat->memory_consumption();
36464 return total_memory;
std::make_unsigned< types::blas_int >::type size_type
Implementation of the class BlockCluster.
Implementation of the class BlockClusterTree.
void split_block_cluster_node(TreeNode< BlockCluster< spacedim, Number >, BlockClusterTree< spacedim, Number >::child_num > *bc_node, BlockClusterTree< spacedim, Number > &bc_tree, const TreeNodeSplitMode split_mode, const bool if_add_child_nodes_to_leaf_set=true)
Class for block cluster tree.
std::vector< node_pointer_type > & get_leaf_set()
void categorize_near_and_far_field_sets()
bool extend_finer_than_partition(const std::vector< node_pointer_type > &partition)
node_pointer_type get_root() const
void calc_depth_and_max_level()
unsigned int get_n_min() const
bool extend_to_finer_partition(const std::vector< node_pointer_type > &partition)
bool prune_to_partition(const std::vector< node_pointer_type > &partition, const bool is_partition_in_bct)
std::size_t memory_consumption() const
void cholesky_solve_upper_task(tbb::flow::graph &dag, HMatrix< spacedim, Number > &Z, const unsigned int fixed_rank, std::mutex &log_stream_lock)
void set_property(const LAPACKFullMatrixExt< Number > &M)
void convertToFullMatrix(MatrixType &M) const
RkMatrix< Number > * get_rkmatrix()
TaskNodePtr factorize_lu_or_cholesky_graph_node
void solve_block_triangular_by_forward_substitution(Vector< Number > &b, const HMatrix< spacedim, Number > &starting_hmat, const bool is_unit_block_diagonal=true) const
std::vector< RkMatrix< Number > * > Sigma_R
void _convertToFullMatrix(MatrixType &M, const HMatrixSupport::Property top_hmat_property=HMatrixSupport::Property::general) const
void solve_cholesky_by_backward_substitution(Vector< Number > &b) const
std::vector< HMatrix< spacedim, Number > * > & get_submatrices()
void solve_by_backward_substitution(Vector< Number > &x, const Vector< Number > &b, const HMatrix< spacedim, Number > &starting_hmat, const bool is_unit_diagonal=false) const
void Tvmult(Vector< Number > &y, const Number2 alpha, const Vector< Number > &x) const
HMatrix< spacedim, Number > * previous_same_level_same_column_hmat_node
void set_current_matrix_property(const HMatrixSupport::Property property)
void solve_cholesky_by_forward_substitution(Vector< Number > &b) const
std::size_t memory_consumption_of_current_hmat_node() const
HMatrix(const HMatrix< spacedim, Number > &H)
void vmult(Vector< Number > &y, const Number2 alpha, const Vector< Number > &x, const HMatrix< spacedim, Number > &starting_hmat, const HMatrixSupport::Property top_hmat_property) const
void solve_block_triangular_by_backward_substitution(Vector< Number > &b, const HMatrix< spacedim, Number > &starting_hmat, const bool is_unit_block_diagonal=false) const
void cholesky_update_task(tbb::flow::graph &dag, HMatrix< spacedim, Number > &diag_block, HMatrix< spacedim, Number > &diag_column_block1, HMatrix< spacedim, Number > &diag_column_block2, const unsigned int fixed_rank, std::mutex &log_stream_lock)
void Hvmult_serial_iterative(const Number2 beta, Vector< Number > &y, const Number3 alpha, const Vector< Number > &x) const
Calculate the top level -matrix/vector multiplication as by iterating over the leaf set.
void add_for_parallel_lu_or_cholesky(const RkMatrix< Number > &B, const std::array< types::global_dof_index, 2 > &B_row_index_range, const std::array< types::global_dof_index, 2 > &B_col_index_range, const size_type fixed_rank_k, const bool is_result_matrix_store_tril_only=false)
void h_h_mmult_reduction()
void solve_by_forward_substitution_matrix_valued(HMatrix< spacedim, Number > &Z, const unsigned int fixed_rank, const bool is_unit_diagonal=true) const
void _distribute_sigma_r_and_f_to_leaves(HMatrix< spacedim, Number > &starting_hmat, const unsigned int fixed_rank=0)
HMatrix(const BlockClusterTree< spacedim, real_type > &bct, const unsigned int fixed_rank_k=1, const HMatrixSupport::Property property=HMatrixSupport::Property::general, const HMatrixSupport::BlockType block_type=HMatrixSupport::BlockType::undefined_block)
void print_matrix_info_as_dot(std::ostream &out)
HMatrix * find_col_diag_block_for_offdiag_block()
void Tvmult(Vector< Number > &y, const Vector< Number > &x, const HMatrix< spacedim, Number > &starting_hmat, const HMatrixSupport::Property top_hmat_property) const
void Hvmult(Vector< Number > &y, const Vector< Number > &x, const HMatrix< spacedim, Number > &starting_hmat, const HMatrixSupport::Property top_hmat_property) const
HMatrix(HMatrix< spacedim, Number > &&H) noexcept
void cholesky_build_update_to_factorize_dependencies(HMatrix< spacedim, Number > &factorize_block)
HMatrix * find_row_diag_block_for_offdiag_block()
void lu_build_update_to_solve_upper_or_lower_dependencies(HMatrix< spacedim, Number > &solve_upper_or_lower_block)
void solve_transpose_by_forward_substitution_matrix_valued(HMatrix< spacedim, Number > &Z, const unsigned int fixed_rank) const
void Tvmult_task_parallel(const Number2 beta, Vector< Number > &y, const Number3 alpha, const Vector< Number > &x) const
std::array< types::global_dof_index, 2 > * get_row_index_range()
HMatrix< spacedim, Number > * get_top_left_leaf_node()
Get the pointer to the top left leaf node in the -matrix.
void mTmult_level_conserving(HMatrix< spacedim, Number > &C, HMatrix< spacedim, Number > &B, const unsigned int fixed_rank, const bool is_result_matrix_store_tril_only=false)
HMatrix(typename BlockClusterTree< spacedim, real_type >::node_const_pointer_type bc_node, HMatrix< spacedim, Number > &&H, const HMatrixSupport::Property property=HMatrixSupport::Property::general, const HMatrixSupport::BlockType block_type=HMatrixSupport::BlockType::undefined_block)
void solve_cholesky_by_backward_substitution(Vector< Number > &b, const HMatrix< spacedim, Number > &starting_hmat) const
void lu_assign_update_to_solve_and_factorize_dependencies()
void link_hmat_nodes_on_cross_from_diagonal_blocks(const HMatrixSupport::Property top_hmat_property)
HMatrixSupport::Property get_property() const
LAPACKFullMatrixExt< Number > * fullmatrix
unsigned int get_n_row_blocks() const
void _compute_cholesky_factorization(HMatrix< spacedim, Number > &L, const unsigned int fixed_rank) const
void h_h_mmult_horizontal_split(BlockClusterTree< spacedim, real_type > &bc_tree)
void vmult(Vector< Number > &y, const Vector< Number > &x, const HMatrix< spacedim, Number > &starting_hmat, const HMatrixSupport::Property top_hmat_property) const
void Tvmult(Vector< Number > &y, const Number2 alpha, const Vector< Number > &x, const HMatrixSupport::Property top_hmat_property) const
void reinit(const BlockClusterTree< spacedim, real_type > &bct, const unsigned int fixed_rank_k=1, const HMatrixSupport::Property property=HMatrixSupport::Property::general, const HMatrixSupport::BlockType block_type=HMatrixSupport::BlockType::diagonal_block)
std::vector< std::pair< HMatrix< spacedim, Number > *, HMatrix< spacedim, Number > * > > Sigma_P
void add(HMatrix< spacedim, Number > &C, const RkMatrix< Number > &B, const size_type fixed_rank_k)
void cholesky_build_update_to_solve_upper_dependencies(HMatrix< spacedim, Number > &solve_upper_block)
void truncate_to_rank_diag_preserve_positive_definite(size_type new_rank, const bool is_only_handle_tril=true)
void solve_transpose_by_forward_substitution(Vector< Number > &b, const HMatrix< spacedim, Number > &starting_hmat) const
void vmult(Vector< Number > &y, const Number2 alpha, const Vector< Number > &x) const
double compute_near_field_hmat_assembly_task_cost(const HMatrixSupport::Property top_hmat_property) const
void Tvmult_add(Vector< Number > &y, const Number2 alpha, const Vector< Number > &x) const
void compute_leaf_set_vmult_or_Tvmult_task_costs(std::vector< double > &task_costs) const
TaskNodePtr solve_upper_or_lower_lu_or_cholesky_graph_node
std::array< types::global_dof_index, 2 > * get_col_index_range()
std::vector< HMatrix< spacedim, Number > * > submatrices
void solve_by_forward_substitution(Vector< Number > &x, const Vector< Number > &b, const bool is_unit_diagonal=true) const
std::vector< HMatrix< spacedim, Number > * >::const_iterator find_block_cluster_in_leaf_set(const BlockCluster< spacedim, real_type > &block_cluster) const
HMatrix< spacedim, Number > * next_same_level_same_row_hmat_node
void Tvmult_serial_iterative(const Number2 beta, Vector< Number > &y, const Number3 alpha, const Vector< Number > &x) const
double compute_far_field_hmat_vmult_or_Tvmult_task_cost(const HMatrixSupport::Property top_hmat_property) const
void reinit(typename BlockClusterTree< spacedim, real_type >::node_const_pointer_type bc_node, const unsigned int fixed_rank_k=1, const HMatrixSupport::Property property=HMatrixSupport::Property::general, const HMatrixSupport::BlockType block_type=HMatrixSupport::BlockType::undefined_block)
void clear_lu_or_cholesky_task_nodes_in_hmat()
void write_leaf_set_by_iteration(std::ostream &out, const real_type singular_value_threshold=0.) const
std::vector< UpdateTaskNodeForLUOrCholesky > update_lu_or_cholesky_graph_nodes
HMatrix(const BlockClusterTree< spacedim, real_type > &bct, HMatrix< spacedim, Number > &&H, const HMatrixSupport::Property property=HMatrixSupport::Property::general, const HMatrixSupport::BlockType block_type=HMatrixSupport::BlockType::diagonal_block)
void h_h_mmult_vertical_split(BlockClusterTree< spacedim, real_type > &bc_tree)
void solve_cholesky_by_forward_substitution(Vector< Number > &x, const Vector< Number > &b) const
void add(const RkMatrix< Number > &B, const size_type fixed_rank_k, const bool is_result_matrix_store_tril_only=false)
std::make_unsigned< types::blas_int >::type size_type
void clear_lu_or_cholesky_task_nodes()
void compute_vmult_contributing_index_ranges_from_all_threads(const unsigned int thread_no)
HMatrix(const BlockClusterTree< spacedim, real_type > &bct, const LAPACKFullMatrixExt< Number > &M, const HMatrixSupport::BlockType block_type=HMatrixSupport::BlockType::diagonal_block)
void compute_cholesky_factorization(HMatrix< spacedim, Number > &L, const unsigned int fixed_rank)
std::vector< HMatrix< spacedim, Number > * > leaf_set
void solve_transpose_by_forward_substitution(Vector< Number > &b) const
void lu_factorize_diagonal_block_task(tbb::flow::graph &dag, std::mutex &log_stream_lock)
void Tvmult(Vector< Number > &y, const Number2 alpha, const Vector< Number > &x, const HMatrix< spacedim, Number > &starting_hmat, const HMatrixSupport::Property top_hmat_property) const
void truncate_to_rank(size_type new_rank)
const RkMatrix< Number > * get_rkmatrix() const
unsigned int submatrix_index
HMatrix(typename BlockClusterTree< spacedim, real_type >::node_const_pointer_type bc_node, const unsigned int fixed_rank_k=1, const HMatrixSupport::Property property=HMatrixSupport::Property::general, const HMatrixSupport::BlockType block_type=HMatrixSupport::BlockType::undefined_block)
void _build_leaf_set_hilbert_traversal(std::vector< HMatrix * > &total_leaf_set, std::vector< HMatrix * > &total_near_field_leaf_set, std::vector< HMatrix * > &total_far_field_leaf_set, HilbertBlockType current_hilbert_block_type, const HMatrixSupport::Property top_hmat_property) const
void solve_transpose_by_forward_substitution_matrix_valued(HMatrix< spacedim, Number > &X, HMatrix< spacedim, Number > &Z, const unsigned int fixed_rank) const
void h_h_mmult_cross_split(BlockClusterTree< spacedim, real_type > &bc_tree)
void distribute_all_non_leaf_nodes_sigma_r_and_f_to_leaves(const unsigned int fixed_rank=0)
std::vector< HMatrix< spacedim, Number > * > near_field_leaf_set
void solve_block_triangular_by_backward_substitution(Vector< Number > &x, const Vector< Number > &b, const bool is_unit_block_diagonal=false) const
void _compute_cholesky_factorization(const unsigned int fixed_rank)
void compute_tvmult_contributing_index_ranges_from_all_threads(const unsigned int thread_no)
void set_default_vmult_strategy()
void set_current_matrix_property(const LAPACKFullMatrixExt< Number > &M)
HMatrix< spacedim, Number > & operator=(HMatrix< spacedim, Number > &&H) noexcept
void Hvmult(Vector< Number > &y, const Number2 alpha, const Vector< Number > &x, const HMatrix< spacedim, Number > &starting_hmat, const HMatrixSupport::Property top_hmat_property) const
HMatrixSupport::BlockType block_type
void print_as_formatted_full_matrix(std::ostream &out, const std::string &name, const unsigned int precision=8, const bool scientific=true, const unsigned int width=0, const char *zero_string="0", const double denominator=1., const double threshold=0.) const
std::vector< HMatrix< spacedim, Number > * > far_field_leaf_set
TreeNodeSplitMode determine_mm_split_mode_from_Sigma_P()
std::array< types::global_dof_index, 2 > * col_index_range
std::array< types::global_dof_index, 2 > * row_index_range
void get_column_index_range_for_leaf_set_interval(const std::pair< int64_t, int64_t > &interval, const unsigned int thread_no)
HMatrix< spacedim, Number > * parent
void calc_rank_upper_bound_for_rkmatrices() const
void Tvmult(Vector< Number > &y, const Vector< Number > &x) const
bool is_current_hmat_node_nonemtpy(const HMatrixSupport::Property top_hmat_property=HMatrixSupport::Property::general) const
BlockClusterTree< spacedim, real_type > Tind
void add(const Number b, const RkMatrix< Number > &B, const std::array< types::global_dof_index, 2 > &B_row_index_range, const std::array< types::global_dof_index, 2 > &B_col_index_range, const size_type fixed_rank_k, const bool is_result_matrix_store_tril_only=false) const
void Hvmult(Vector< Number > &y, const Vector< Number > &x) const
void lu_build_solve_lower_to_update_dependencies(HMatrix< spacedim, Number > &update_block)
void compute_near_field_leaf_set_assembly_task_costs(std::vector< double > &task_costs) const
void mTmult_level_conserving(HMatrix< spacedim, Number > &C, const Number alpha, HMatrix< spacedim, Number > &B, const unsigned int fixed_rank, const bool is_result_matrix_store_tril_only=false)
void write_leaf_set(std::ostream &out, const real_type singular_value_threshold=0.) const
void print_formatted(std::ostream &out, const unsigned int precision=3, const bool scientific=true, const unsigned int width=0, const char *zero_string=" ", const double denominator=1., const double threshold=0.) const
void mmult_level_conserving(HMatrix< spacedim, Number > &C, const Number alpha, HMatrix< spacedim, Number > &B, const unsigned int fixed_rank, const bool is_result_matrix_store_tril_only=false)
HMatrix(typename BlockClusterTree< spacedim, real_type >::node_const_pointer_type bc_node, const LAPACKFullMatrixExt< Number > &M, const unsigned int fixed_rank_k, const HMatrixSupport::Property property=HMatrixSupport::Property::general, const HMatrixSupport::BlockType block_type=HMatrixSupport::BlockType::undefined_block)
void vmult(Vector< Number > &y, const Number2 alpha, const Vector< Number > &x, const HMatrixSupport::Property top_hmat_property) const
void convert_between_different_block_cluster_trees(BlockClusterTree< spacedim, real_type > &bct1, BlockClusterTree< spacedim, real_type > &bct2, const unsigned int fixed_rank_k2=1)
HMatrix< spacedim, Number > & operator=(const HMatrix< spacedim, Number > &H)
void solve_lu(Vector< Number > &x, const Vector< Number > &b) const
const std::vector< HMatrix< spacedim, Number > * > & get_leaf_set() const
void assign_node_ids_for_dot()
void solve_cholesky_by_backward_substitution(Vector< Number > &x, const Vector< Number > &b) const
void truncate_to_rank_off_diag_preserve_positive_definite(size_type new_rank, const bool is_compensate_diag_blocks=true)
void set_current_matrix_block_type(const HMatrixSupport::BlockType block_type)
void add(const Number b, const RkMatrix< Number > &B, const size_type fixed_rank_k, const bool is_result_matrix_store_tril_only=false)
void solve_cholesky_by_backward_substitution(Vector< Number > &x, const Vector< Number > &b, const HMatrix< spacedim, Number > &starting_hmat) const
static const unsigned int submatrix_index_invalid
void Hvmult(Vector< Number > &y, const Vector< Number > &x, const HMatrixSupport::Property top_hmat_property) const
HMatrixSupport::State get_state() const
void solve_block_triangular_by_forward_substitution(Vector< Number > &x, const Vector< Number > &b, const HMatrix< spacedim, Number > &starting_hmat, const bool is_unit_block_diagonal=true) const
const std::array< types::global_dof_index, 2 > * get_row_index_range() const
void vmult_task_parallel(const Number2 beta, Vector< Number > &y, const Number3 alpha, const Vector< Number > &x) const
tbb::flow::continue_node< tbb::flow::continue_msg > TaskNode
const std::array< types::global_dof_index, 2 > * get_col_index_range() const
const std::vector< HMatrix< spacedim, Number > * > & get_submatrices() const
void add(HMatrix< spacedim, Number > &C, const HMatrix< spacedim, Number > &B, const size_type fixed_rank_k) const
void truncate_to_rank_preserve_positive_definite(size_type new_rank, const bool is_only_handle_tril=true)
void solve_transpose_by_forward_substitution(Vector< Number > &x, const Vector< Number > &b) const
void add(const HMatrix< spacedim, Number > &B, const size_type fixed_rank_k) const
LAPACKFullMatrixExt< Number > * get_fullmatrix()
void remove_hmat_pair_from_mm_product_list(const HMatrix< spacedim, Number > *M1, const HMatrix< spacedim, Number > *M2)
HMatrix(const BlockClusterTree< spacedim, real_type > &bct, const LAPACKFullMatrixExt< Number > &M, const unsigned int fixed_rank_k, const HMatrixSupport::BlockType block_type=HMatrixSupport::BlockType::diagonal_block)
void vmult(Vector< Number > &y, const Vector< Number > &x) const
HMatrix< spacedim, Number > * previous_same_level_same_row_hmat_node
HMatrixSupport::BlockType get_block_type() const
HMatrix< spacedim, Number > * next_same_level_hmat_node
static SpaceFillingCurveType leaf_set_traversal_method
void vmult_add(Vector< Number > &y, const Vector< Number > &x) const
void coarsen_to_subtree(const BlockClusterTree< spacedim, real_type > &subtree, const unsigned int fixed_rank_k)
void remove_hmat_pair_from_mm_product_list(const std::pair< const HMatrix< spacedim, Number > *, const HMatrix< spacedim, Number > * > &hmat_pair)
void coarsen_to_partition(const std::vector< typename BlockClusterTree< spacedim, real_type >::node_pointer_type > &partition, const unsigned int fixed_rank_k)
std::vector< LAPACKFullMatrixExt< Number > * > Sigma_F
void solve_block_triangular_by_forward_substitution(Vector< Number > &x, const Vector< Number > &b, const bool is_unit_block_diagonal=true) const
void solve_block_triangular_by_backward_substitution(Vector< Number > &b, const bool is_unit_block_diagonal=false) const
void Hvmult_add(Vector< Number > &y, const Vector< Number > &x) const
void mmult(HMatrix< spacedim, Number > &C, HMatrix< spacedim, Number > &B, const BlockClusterTree< spacedim, real_type > &bct_a, const BlockClusterTree< spacedim, real_type > &bct_b, BlockClusterTree< spacedim, real_type > &bct_c, const unsigned int fixed_rank, const bool adding)
RkMatrix< Number > * rkmatrix
void print_current_matrix_info(std::ostream &out) const
std::unique_ptr< HMatrixVmultStrategy< spacedim, Number > > vmult_strategy
void set_property(const HMatrixSupport::Property property)
std::size_t memory_consumption_of_far_field_leaf_set() const
HMatrixType get_type() const
void solve_by_forward_substitution(Vector< Number > &x, const Vector< Number > &b, const HMatrix< spacedim, Number > &starting_hmat, const bool is_unit_diagonal=true) const
void Hvmult_add(Vector< Number > &y, const Number2 alpha, const Vector< Number > &x) const
void solve_transpose_by_forward_substitution(Vector< Number > &x, const Vector< Number > &b, const HMatrix< spacedim, Number > &starting_hmat) const
void Hvmult(Vector< Number > &y, const Number2 alpha, const Vector< Number > &x) const
void lu_solve_lower_task(tbb::flow::graph &dag, HMatrix< spacedim, Number > &Z, const unsigned int fixed_rank, std::mutex &log_stream_lock)
std::size_t memory_consumption_of_near_field_leaf_set() const
void compute_cholesky_dag(tbb::flow::graph &dag, const unsigned int fixed_rank, std::mutex &log_stream_lock)
unsigned int get_n_col_blocks() const
std::size_t memory_consumption_of_leaf_set() const
void cholesky_assign_update_to_solve_and_factorize_dependencies()
void print_leaf_set_info(std::ostream &out) const
void Tvmult(Vector< Number > &y, const Vector< Number > &x, const HMatrixSupport::Property top_hmat_property) const
HMatrixSupport::State state
std::unique_ptr< std::vector< VmultOrTvmultThreadData > > data_for_vmult_or_tvmult_threads
void solve_by_backward_substitution(Vector< Number > &x, const Vector< Number > &b, const bool is_unit_diagonal=false) const
void solve_block_triangular_by_forward_substitution(Vector< Number > &b, const bool is_unit_block_diagonal=true) const
void write_fullmatrix_leaf_node(std::ostream &out, const real_type singular_value_threshold=0.) const
void compute_lu_factorization(const unsigned int fixed_rank)
unsigned int compute_vmult_or_tvmult_thread_num(const bool is_vmult, const bool is_tvmult) const
void compute_cholesky_factorization(const unsigned int fixed_rank)
void lu_solve_upper_task(tbb::flow::graph &dag, HMatrix< spacedim, Number > &Z, const unsigned int fixed_rank, std::mutex &log_stream_lock)
HMatrix< spacedim, Number > * next_same_level_same_column_hmat_node
void add(const RkMatrix< Number > &B, const std::array< types::global_dof_index, 2 > &B_row_index_range, const std::array< types::global_dof_index, 2 > &B_col_index_range, const size_type fixed_rank_k, const bool is_result_matrix_store_tril_only=false) const
void compute_far_field_leaf_set_assembly_task_costs(std::vector< double > &task_costs) const
bool is_far_field() const
void compute_cholesky_factorization_task_parallel(const unsigned int fixed_rank)
void write_rkmatrix_leaf_node(std::ostream &out) const
void lu_or_cholesky_build_solve_upper_to_update_dependencies(HMatrix< spacedim, Number > &update_block)
void solve_cholesky(Vector< Number > &x, const Vector< Number > &b) const
std::vector< HMatrix< spacedim, Number > * > & get_leaf_set()
void solve_by_backward_substitution(Vector< Number > &b, const bool is_unit_diagonal=false) const
void addsym_diag(const LAPACKFullMatrixExt< Number > &E)
void set_state(const HMatrixSupport::State state)
void solve_cholesky_by_forward_substitution_matrix_valued(HMatrix< spacedim, Number > &X, HMatrix< spacedim, Number > &Z, const unsigned int fixed_rank) const
void solve_cholesky_by_forward_substitution(Vector< Number > &x, const Vector< Number > &b, const HMatrix< spacedim, Number > &starting_hmat) const
void _compute_lu_factorization(const unsigned int fixed_rank)
void mmult_level_conserving(HMatrix< spacedim, Number > &C, HMatrix< spacedim, Number > &B, const unsigned int fixed_rank, const bool is_result_matrix_store_tril_only=false)
void vmult_add(Vector< Number > &y, const Number2 alpha, const Vector< Number > &x) const
BlockClusterTree< spacedim, real_type >::node_pointer_type bc_node
double compute_near_field_hmat_vmult_or_Tvmult_task_cost(const HMatrixSupport::Property top_hmat_property) const
void refine_to_supertree()
void Tmmult_level_conserving(HMatrix< spacedim, Number > &C, const Number alpha, HMatrix< spacedim, Number > &B, const unsigned int fixed_rank, const bool is_result_matrix_store_tril_only=false)
void compute_lu_dag(tbb::flow::graph &dag, const unsigned int fixed_rank, std::mutex &log_stream_lock)
void solve_by_forward_substitution_matrix_valued(HMatrix< spacedim, Number > &X, HMatrix< spacedim, Number > &Z, const unsigned int fixed_rank, const bool is_unit_diagonal=true) const
const HMatrix< spacedim, Number > * get_top_left_leaf_node() const
Get the pointer to the top left leaf node in the -matrix.
void set_property_for_converted_fullmatrix(LAPACKFullMatrixExt< Number > &M) const
void Hvmult(Vector< Number > &y, const Number2 alpha, const Vector< Number > &x, const HMatrixSupport::Property top_hmat_property) const
void print_matrix_info(std::ostream &out) const
void link_hmat_nodes_on_same_levels()
std::size_t memory_consumption() const
void compute_lu_factorization_task_parallel(const unsigned int fixed_rank)
void vmult(Vector< Number > &y, const Vector< Number > &x, const HMatrixSupport::Property top_hmat_property) const
void _build_leaf_set_z_traversal(std::vector< HMatrix * > &total_leaf_set, std::vector< HMatrix * > &total_near_field_leaf_set, std::vector< HMatrix * > &total_far_field_leaf_set, const HMatrixSupport::Property top_hmat_property) const
void lu_update_task(tbb::flow::graph &dag, HMatrix< spacedim, Number > &diag_block, HMatrix< spacedim, Number > &diag_column_block, HMatrix< spacedim, Number > &diag_row_block, const unsigned int fixed_rank, std::mutex &log_stream_lock)
void solve_block_triangular_by_backward_substitution(Vector< Number > &x, const Vector< Number > &b, const HMatrix< spacedim, Number > &starting_hmat, const bool is_unit_block_diagonal=false) const
void solve_by_forward_substitution(Vector< Number > &b, const HMatrix< spacedim, Number > &starting_hmat, const bool is_unit_diagonal=true) const
void prepare_for_vmult_or_tvmult(const bool is_vmult, const bool is_tvmult)
void set_current_matrix_state(const HMatrixSupport::State state)
void _compute_lu_factorization(HMatrix< spacedim, Number > &LU, const unsigned int fixed_rank) const
void solve_cholesky_transpose_by_forward_substitution_matrix_valued(HMatrix< spacedim, Number > &X, HMatrix< spacedim, Number > &Z, const unsigned int fixed_rank) const
void Hvmult_task_parallel(const Number2 beta, Vector< Number > &y, const Number3 alpha, const Vector< Number > &x) const
void lu_build_update_to_factorize_dependencies(HMatrix< spacedim, Number > &factorize_block)
void add(HMatrix< spacedim, Number > &C, const Number b, const HMatrix< spacedim, Number > &B, const size_type fixed_rank_k) const
void solve_cholesky_transpose_by_forward_substitution_matrix_valued(HMatrix< spacedim, Number > &Z, const unsigned int fixed_rank) const
void set_block_type(const HMatrixSupport::BlockType block_type)
std::vector< HMatrix< spacedim, Number > * >::iterator find_block_cluster_in_leaf_set(const BlockCluster< spacedim, real_type > &block_cluster)
const LAPACKFullMatrixExt< Number > * get_fullmatrix() const
void solve_by_forward_substitution(Vector< Number > &b, const bool is_unit_diagonal=true) const
void set_vmult_strategy(std::unique_ptr< HMatrixVmultStrategy< spacedim, Number > > strategy)
void solve_by_backward_substitution(Vector< Number > &b, const HMatrix< spacedim, Number > &starting_hmat, const bool is_unit_diagonal=false) const
void get_row_index_range_for_leaf_set_interval(const std::pair< int64_t, int64_t > &interval, const unsigned int thread_no)
bool is_near_field() const
void compute_lu_factorization(HMatrix< spacedim, Number > &LU, const unsigned int fixed_rank)
void Tvmult_add(Vector< Number > &y, const Vector< Number > &x) const
void add(const Number b, const HMatrix< spacedim, Number > &B, const size_type fixed_rank_k) const
void add(HMatrix< spacedim, Number > &C, const Number b, const RkMatrix< Number > &B, const size_type fixed_rank_k)
void _invert_by_gauss_elim(HMatrix< spacedim, Number > &M_inv, const size_type fixed_rank_k)
void invert_by_gauss_elim(HMatrix< spacedim, Number > &M_inv, const size_type fixed_rank_k)
void mmult(HMatrix< spacedim, Number > &C, HMatrix< spacedim, Number > &B, const BlockClusterTree< spacedim, real_type > &bct_a, const BlockClusterTree< spacedim, real_type > &bct_b, BlockClusterTree< spacedim, real_type > &bct_c, const unsigned int fixed_rank=1)
double compute_far_field_hmat_assembly_task_cost(const HMatrixSupport::Property top_hmat_property) const
void _print_matrix_info_as_dot_node(std::ostream &out) const
void vmult_serial_iterative(const Number2 beta, Vector< Number > &y, const Number3 alpha, const Vector< Number > &x) const
void cholesky_factorize_diagonal_block_task(tbb::flow::graph &dag, std::mutex &log_stream_lock)
HMatrixSupport::Property property
void Tmmult_level_conserving(HMatrix< spacedim, Number > &C, HMatrix< spacedim, Number > &B, const unsigned int fixed_rank, const bool is_result_matrix_store_tril_only=false)
HMatrix(typename BlockClusterTree< spacedim, real_type >::node_const_pointer_type bc_node, const LAPACKFullMatrixExt< Number > &M, const HMatrixSupport::Property property=HMatrixSupport::Property::general, const HMatrixSupport::BlockType block_type=HMatrixSupport::BlockType::undefined_block)
void solve_cholesky_by_forward_substitution(Vector< Number > &b, const HMatrix< spacedim, Number > &starting_hmat) const
void get_column(const size_type col_index, Vector< Number > &col_values) const
void fill_col(const size_type col_index, const Vector< Number > &values, const bool is_adding=false)
LAPACKSupport::Property get_property() const
std::make_unsigned< types::blas_int >::type size_type
void set_property(const LAPACKSupport::Property property)
void mTmult(LAPACKFullMatrixExt< Number > &C, const LAPACKFullMatrixExt< Number > &B, bool adding=false) const
void fill_row(const size_type row_index, const Vector< Number > &values, const bool is_adding=false)
void print_formatted_to_mat(std::ostream &out, const std::string &name, const unsigned int precision=8, const bool scientific=true, const unsigned int width=0, const char *zero_string="0", const double denominator=1., const double threshold=0.) const
void get_row(const size_type row_index, Vector< Number > &row_values) const
void reinit(const size_type m, const size_type n, const size_type fixed_rank_k)
void restrictToFullMatrix(const std::array< types::global_dof_index, 2 > &tau_index_range, const std::array< types::global_dof_index, 2 > &sigma_index_range, LAPACKFullMatrixExt< Number > &matrix) const
bool convertToFullMatrix(LAPACKFullMatrixExt< Number > &matrix) const
Configurations for building the project.
#define ARENA_MAX_CONCURRENCY_IN_LU_AND_CHOL
This header file contains a set of self-defined generic functors.
InputIterator find_pointer_data(InputIterator first, InputIterator last, const T *value_pointer)
void RefineHMatrixWrtExtendedBlockClusterTree(HMatrix< spacedim, Number > *starting_hmat, HMatrix< spacedim, Number > *current_hmat)
void h_h_mmult_from_leaf_node(HMatrix< spacedim, Number > &M0, HMatrix< spacedim, Number > &M, HMatrix< spacedim, Number > &M1, HMatrix< spacedim, Number > &M2, const HMatrixSupport::BlockType block_type_for_local_Z, const unsigned int fixed_rank, const bool is_result_matrix_store_tril_only=false)
DeclException1(ExcInvalidHMatrixType, HMatrixType,<< "Invalid H-matrix node type: "<< arg1)
void convertHMatBlockToRkMatrix(HMatrix< spacedim, Number > *hmat_block, const unsigned int fixed_rank_k, const HMatrix< spacedim, Number > *hmat_root_block=nullptr, size_t *calling_counter=nullptr, const std::string &output_file_base_name=std::string("hmat-bct"))
void h_h_Tmmult_from_leaf_node(HMatrix< spacedim, Number > &M0, HMatrix< spacedim, Number > &M, HMatrix< spacedim, Number > &M1, HMatrix< spacedim, Number > &M2, const HMatrixSupport::BlockType block_type_for_local_Z, const unsigned int fixed_rank, const bool is_result_matrix_store_tril_only=false)
void copy_hmatrix_node(HMatrix< spacedim, Number > &hmat_dst, const HMatrix< spacedim, Number > &hmat_src)
void f_h_Tmmult(const LAPACKFullMatrixExt< Number > &M1, HMatrix< spacedim, Number > &M2, LAPACKFullMatrixExt< Number > &M)
void f_h_mmult_for_h_h_mmult(const HMatrix< spacedim, Number > *M1, HMatrix< spacedim, Number > *M2, HMatrix< spacedim, Number > *M, bool is_M1M2_last_in_M_Sigma_P=true)
void h_rk_Tmmult(HMatrix< spacedim, Number > &M1, const RkMatrix< Number > &M2, RkMatrix< Number > &M)
void h_f_mmult_for_h_h_mmult(HMatrix< spacedim, Number > *M1, const HMatrix< spacedim, Number > *M2, HMatrix< spacedim, Number > *M, bool is_M1M2_last_in_M_Sigma_P=true)
void f_h_mmult(const LAPACKFullMatrixExt< Number > &M1, HMatrix< spacedim, Number > &M2, LAPACKFullMatrixExt< Number > &M)
void h_h_mmult_phase2(HMatrix< spacedim, Number > &M, BlockClusterTree< spacedim, typename numbers::NumberTraits< Number >::real_type > &target_bc_tree, const unsigned int fixed_rank)
void rk_h_mmult_for_h_h_mmult(const HMatrix< spacedim, Number > *M1, HMatrix< spacedim, Number > *M2, HMatrix< spacedim, Number > *M, bool is_M1M2_last_in_M_Sigma_P=true)
void h_h_mTmult_level_conserving(HMatrix< spacedim, Number > &M, HMatrix< spacedim, Number > &M1, HMatrix< spacedim, Number > &M2, const unsigned int fixed_rank, const bool is_result_matrix_store_tril_only=false)
void h_rk_mTmult(HMatrix< spacedim, Number > &M1, const RkMatrix< Number > &M2, RkMatrix< Number > &M)
void h_h_mTmult_from_leaf_node(HMatrix< spacedim, Number > &M0, HMatrix< spacedim, Number > &M, HMatrix< spacedim, Number > &M1, HMatrix< spacedim, Number > &M2, const HMatrixSupport::BlockType block_type_for_local_Z, const unsigned int fixed_rank, const bool is_result_matrix_store_tril_only=false)
void h_h_mmult_from_leaf_node_for_parallel_lu(HMatrix< spacedim, Number > &M0, HMatrix< spacedim, Number > &M, const Number alpha, HMatrix< spacedim, Number > &M1, HMatrix< spacedim, Number > &M2, const HMatrixSupport::BlockType block_type_for_local_Z, const unsigned int fixed_rank, const bool is_result_matrix_store_tril_only=false)
void rk_h_mmult(const RkMatrix< Number > &M1, HMatrix< spacedim, Number > &M2, RkMatrix< Number > &M)
void rk_h_Tmmult(const RkMatrix< Number > &M1, HMatrix< spacedim, Number > &M2, RkMatrix< Number > &M)
void InitAndCreateHMatrixChildren(HMatrix< spacedim, Number > *hmat, typename BlockClusterTree< spacedim, typename numbers::NumberTraits< Number >::real_type >::node_const_pointer_type bc_node, const unsigned int fixed_rank_k, const HMatrixSupport::Property top_hmat_node_property=HMatrixSupport::Property::general)
void h_rk_mmult_for_h_h_mmult(HMatrix< spacedim, Number > *M1, const HMatrix< spacedim, Number > *M2, HMatrix< spacedim, Number > *M, bool is_M1M2_last_in_M_Sigma_P=true)
void h_h_mTmult_level_conserving_for_parallel_cholesky(HMatrix< spacedim, Number > &M, const Number alpha, HMatrix< spacedim, Number > &M1, HMatrix< spacedim, Number > &M2, const unsigned int fixed_rank, const bool is_result_matrix_store_tril_only=false)
void h_f_Tmmult(HMatrix< spacedim, Number > &M1, const LAPACKFullMatrixExt< Number > &M2, LAPACKFullMatrixExt< Number > &M)
void h_f_mTmult(HMatrix< spacedim, Number > &M1, const LAPACKFullMatrixExt< Number > &M2, LAPACKFullMatrixExt< Number > &M)
void h_h_Tmmult_level_conserving(HMatrix< spacedim, Number > &M, HMatrix< spacedim, Number > &M1, HMatrix< spacedim, Number > &M2, const unsigned int fixed_rank, const bool is_result_matrix_store_tril_only=false)
void InitHMatrixWrtBlockClusterNode(HMatrix< spacedim, Number > &hmat, typename BlockClusterTree< spacedim, typename numbers::NumberTraits< Number >::real_type >::node_const_pointer_type bc_node)
@ RkMatrixType
RkMatrixType.
@ FullMatrixType
FullMatrixType.
@ HierarchicalMatrixType
HierarchicalType.
@ UndefinedMatrixType
UndefinedMatrixType.
void h_h_mmult_level_conserving_for_parallel_lu(HMatrix< spacedim, Number > &M, const Number alpha, HMatrix< spacedim, Number > &M1, HMatrix< spacedim, Number > &M2, const unsigned int fixed_rank, const bool is_result_matrix_store_tril_only=false)
void rk_h_mTmult(const RkMatrix< Number > &M1, HMatrix< spacedim, Number > &M2, RkMatrix< Number > &M)
void h_h_mTmult_from_leaf_node_for_parallel_cholesky(HMatrix< spacedim, Number > &M0, HMatrix< spacedim, Number > &M, const Number alpha, HMatrix< spacedim, Number > &M1, HMatrix< spacedim, Number > &M2, const HMatrixSupport::BlockType block_type_for_local_Z, const unsigned int fixed_rank, const bool is_result_matrix_store_tril_only=false)
void f_h_mTmult(const LAPACKFullMatrixExt< Number > &M1, HMatrix< spacedim, Number > &M2, LAPACKFullMatrixExt< Number > &M)
void h_h_mmult_phase1_recursion(HMatrix< spacedim, Number > *M, BlockClusterTree< spacedim, typename numbers::NumberTraits< Number >::real_type > &Tind)
void h_f_mmult(HMatrix< spacedim, Number > &M1, const LAPACKFullMatrixExt< Number > &M2, LAPACKFullMatrixExt< Number > &M)
void copy_hmatrix(HMatrix< spacedim, Number > &hmat_dst, const HMatrix< spacedim, Number > &hmat_src)
void h_h_mmult_level_conserving(HMatrix< spacedim, Number > &M, HMatrix< spacedim, Number > &M1, HMatrix< spacedim, Number > &M2, const unsigned int fixed_rank, const bool is_result_matrix_store_tril_only=false)
void InitAndCreateHMatrixChildrenWithoutAlloc(HMatrix< spacedim, Number > *hmat, typename BlockClusterTree< spacedim, typename numbers::NumberTraits< Number >::real_type >::node_const_pointer_type bc_node)
void h_rk_mmult(HMatrix< spacedim, Number > &M1, const RkMatrix< Number > &M2, RkMatrix< Number > &M)
Adapted from deal.ii/lac/lapack_support.h and define some features for an -matrix.
Strategies for top level H-matrix/vector multiplications, namely, vmult , Tvmult ,...
Definition of ranks for different types of numbers.
Definition of rank-k matrix.
Vector< Number > local_tvmult_result
std::array< types::global_dof_index, 2 > vmult_result_index_range
std::array< types::global_dof_index, 2 > local_tvmult_result_index_range
std::array< types::global_dof_index, 2 > local_vmult_result_index_range
std::vector< std::array< types::global_dof_index, 2 > > vmult_result_index_ranges_contributed_from_other_threads
Vector< Number > local_vmult_result
std::pair< int64_t, int64_t > leaf_set_interval
std::vector< std::array< types::global_dof_index, 2 > > tvmult_result_index_ranges_contributed_from_other_threads
std::array< types::global_dof_index, 2 > tvmult_result_index_range